March 28, 2024, 08:58:53 AM

See more Support incidents in our old archived forum.

Author Topic: FlexyGantt / Removing a task  (Read 5328 times)

omid.bayani

  • Customers
  • Newbie
  • *
  • Posts: 4
FlexyGantt / Removing a task
« on: April 21, 2015, 08:48:11 AM »
Hi,

I implemented a delete action using the context menu. The event that processes the task deletion is similar to:

var flexyNodeData = options.$trigger.closest('tr')[0]['data-grid-item']._data;
var task = options.$trigger[0].DataContext;
$.observable(flexyNodeData.tasks).remove(task);


This code works but not as expected: the task (ie the bar) is removed in the Flexy Gantt but not the entire line. So I still can see the line and the name of the resource in the gantt table on the left without any task bar. How can I force the code to remove the entire line and not only the task bar?

Thanks.

omid.bayani

  • Customers
  • Newbie
  • *
  • Posts: 4
Re: FlexyGantt / Removing a task
« Reply #1 on: April 22, 2015, 09:06:55 AM »
Hi,

I ended up implementing the below code and it works as expected:

   var team = options.$trigger.closest('tr')[0]['data-grid-item'].HierarchicalItem._parentItem.data;
   var resource = options.$trigger.closest('tr')[0]['data-grid-item']._data;
   var task = options.$trigger[0].DataContext;

   $.observable(resource.tasks).remove(task);
   if (resource.tasks.length === 0) { //If resource does not contain any more tasks, remove the entire resource line.
       $.observable(team.resources).remove(resource); // This will remove the entire resource from the hierarchy.
   }


Hope this is the right way to implement this behavior.
Thanks.

amarnath

  • RQ Members
  • Newbie
  • *
  • Posts: 33
Re: FlexyGantt / Removing a task
« Reply #2 on: April 22, 2015, 10:48:44 AM »
Omid,

Yes, this is the right way to do it.

Thanks,
Amar