Parent with child, want to show full date of the parent

In my Gantt, with the parent, I would like to show the full width of the bar based on startdate and enddate.

That's working well until I add a subtask.  Suddenly the parent takes the size of the date of my subtask.

I want the parent to keep the same size as he had before having a subtask.

I tried the manual mode, but now I have two parents in the Gantt, and I do not want that.

How can I achieve that?

thanks


Attachment: Pictures_5cc8b6b1.rar

3 Replies 1 reply marked as answer

GM Gopinath Munusamy Syncfusion Team July 14, 2022 01:25 PM UTC

Hi Frédéric,


It is the default behaviour, where the start and end date of the parent task should be adjust based on the start and end date of the child task. So, we cannot keep the parent task to a fixed start and end date. We have provided a work around to achieve your requirement using queryTaskbarInfo event in manual mode to keep the parent task on same size even after adding the child task. We have attached sample for your reference, please refer to the below sample and code snippets for more information.


Code snippet:

queryTaskbarInfo: function (args) {

    if (args.data.isManual && args.data.hasChildRecords) {

        args.taskbarElement.style.left = args.data.ganttProperties.left + 'px';

        args.taskbarElement.querySelector('.e-gantt-parent-taskbar-inner-div').style.width = args.data.ganttProperties.width + 'px';

        args.taskbarElement.querySelector('.e-manualparent-main-container').style.visibility = 'hidden';

    }

  },


Sample: https://stackblitz.com/edit/88v3r2?file=index.js


Regards,

Gopinath M


Marked as answer

FR Frédéric July 15, 2022 01:21 AM UTC

that's perfect ! thanks !



AS Aruna Shree Natarajan Syncfusion Team July 15, 2022 12:01 PM UTC

Hi Frédéric


If you are satisfied with our response, please mark it as an answer. Otherwise, please let us know if you have any further queries on this. We are happy to help you.



Regards,

Aruna.


Loader.
Up arrow icon