RadiantQ Forum
Product => jQuery Gantt Package => Topic started by: omid.bayani 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.
-
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.
-
Omid,
Yes, this is the right way to do it.
Thanks,
Amar