January 16, 2018, 11:35:49 AM

See more Support incidents in our old archived forum.

Author Topic: How do I prevent outdent?  (Read 1245 times)

steve.vilotti

  • Customers
  • Newbie
  • *
  • Posts: 5
How do I prevent outdent?
« 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"?

Rajagopal

  • RQ Members
  • Jr. Member
  • *
  • Posts: 92
Re: How do I prevent outdent?
« Reply #1 on: January 04, 2016, 03:39:15 PM »
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,
Code: [Select]
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.