Our state of the art Gantt chart


Post by NBhavadharani »

Hi team ,
How can we open the specific tab on click of item in right click menu .
example : we have five item on right click , suppose we click on the referenceTab menu item then the edit task should open with reference tab as active tab .

I have shared a screenshot of the task menu.

Attachments
right click menu.PNG
right click menu.PNG (20.82 KiB) Viewed 482 times

Post by alex.l »

Please check this thread: viewtopic.php?f=52&t=16826&p=83684

this.gantt.instance.on('beforeTaskEditShow', ({ editor }) {
    const desiredTabIndex = 3;
    editor.widgetMap.tabs.activeTab = desiredTabIndex;
})

All the best,
Alex


Post by NBhavadharani »

 referenceDetails: {
                text: "Reference Details",

            onItem() {
              debugger;
              let gantt = window.getBryntumControl("gantt");
              console.log("GANTTT", gantt);
              gantt.on("beforeTaskEditShow", ({ editor }) => {
                console.log("EDITOR", editor);
                const desiredTabIndex = 0;

                editor.I trewidgetMap.tabs.activeTab = desiredTabIndex;
              });
            },
          },

I tried the way you said. but the debugger is not hitting inside the function.
Is the way Im doing correct , how should I proceed?


Post by alex.l »

Hi NBhavadharani,

I am not sure what do you expect from the code you provided.
https://bryntum.com/docs/gantt/#SchedulerPro/feature/TaskEdit#event-beforeTaskEditShow listener should be added before you open your TaskEditor. As example, add this into Gantt init configuration or after, but before you clicked on context menu item:

listeners : {
    beforeTaskEditShow: ({ editor }) => {
        const desiredTabIndex = 3;
        editor.widgetMap.tabs.activeTab = desiredTabIndex;
    })
}

To open the TaskEditor please use https://bryntum.com/docs/gantt/#Gantt/feature/TaskEdit#function-editTask

const taskYouNeed = gantt.taskStore.getAt(3);
gantt.editTask(taskYouNeed);

All the best,
Alex


Post Reply