RadiantQ Forum
Product => jQuery Gantt Package => Topic started by: steve.vilotti on December 30, 2015, 05:58:32 PM
-
I have modified the ProvideWBSIDHandler to start the WBS at "0" to simulate a Project-like zero level task. What I need to do now is to prevent the tasks that start with a WBS of "1" from outdenting to "0". Any ideas on how I catch the outdent event and cancel it if the WBS of the outdenting task starts with a "1"?
-
Steve,
You have to listen for the "BeforeContextMenu" in table context menu and you can prevent there based on the condition whatever you needed.
Here is the code to do this,
var ganttControl = $gantt_container.data("GanttControl");
var tableContextMenu = ganttControl.TableContextMenu;
tableContextMenu.BeforeContextMenu.subscribe(function ($trigger, e) {
// To support IE8
//var wbsvalue = ganttControl.SelectedActivity.WBSID_M();
var wbsvalue = ganttControl.SelectedActivity.WBSID;
// To convert the WBS value into integer value.
// So, it will convert 1.x as 1 and will apply the same setting for it's child activities as well.
if (parseInt(wbsvalue) == 1) {
// To disable the outdent context menu.
tableContextMenu.Items.Outdent.disabled = true;
}
});
Thanks,
- Raja.