Is it possible to resize multiple task bars at the same time? For instance if I were to highlight two rows and resize one task bar how can I apply that same resize to the other task bar
Hi Stephan,
Greetings from Syncfusion support.
We can achieve your requirement by using the updateRecordByID method in the actionComplete event. We have taken the details of the two selected records in the rowSelected event and have identified the record which was modified. Then, we have set the start date and duration of the other selected record to that of the modified record and updated using the updateRecordByID method. The below code snippets demonstrate the solution.
Index.js
rowSelected(args) { this.selectedrecords = this.ganttInstance.selectionModule.getSelectedRecords(); } actionBegin(args) { this.flag = false; } actionComplete(args) { if (args.action == "TaskbarEditing" && args.requestType == "save" && !this.flag) { for (var i = 0; i < this.selectedrecords.length; i++) { if (args.data.TaskID == this.selectedrecords[i].TaskID) { this.selectedrecords.splice(i, 1); } } this.selectedrecords[0].StartDate = args.data.StartDate; this.selectedrecords[0].Duration = args.data.Duration; this.ganttInstance.updateRecordByID(this.selectedrecords[0]); this.flag = true; } }
|
Sample: https://stackblitz.com/edit/react-xf8tcs?file=index.js
Regards,
Monisha.
Hi Monisha,
I was able to implement this code from what you wrote back as well as from the sample, however, I am running into an issue where when the updateRecordsByID fires it deletes that record from the Gantt Chart. I am having a hard time figuring out why. To maybe help and give more reference I have dropped the files we are using to create the Gantt Chart in. Any help as to understand what I am doing wrong or how to correct would be helpful.
Regards,
Stephan Jones
Hi Stephan,
We need time to validate the reported issue and will share further details within one business days on 26th August 2022. Until then we appreciate your patience.
Regards,
Gopinath M
Hi Stephan,
We have checked the code snippets you have shared. However, we were unable to replicate the reported issue. We have attached sample for your reference, and we request you to share below details, which will be useful for us to provide you with a better solution.
1. Video demonstration of the issue.
2. Is there any console error thrown? If yes, please share the screenshot of the error.
3. Modify the attached sample as issue replicable, if possible.
Sample: https://stackblitz.com/edit/react-xf8tcs-at4dgt?file=index.js
Regards,
Gopinath M
Gopinath,
1) Yes I can provide a video demonstration. I did make a mistake in the code I sent: it should be updateRecordById not updateRecordByIndex.
I wasn't able to upload the file to the post so I put it on google drive.
https://drive.google.com/file/d/1PPTZUqcA3KEqc6eR56KsjBq7s8PJ4e1c/view?usp=sharing
2). No console errors are thrown, unless you try to resize again after reszing. I actually get that same error in your example as well.
3). I'll see if I can modify the sample to reproduce what I was experiencing.
Thanks,
Stephan
Hi Stephan,
We apologize for the inconvenience caused. We need time to validate the reported issue and will share further details within two business days on September 1, 2022. Until then we appreciate your patience.
Regards,
Gopinath M
Hi Stephan,
We were able to replicate the reported issue. We have considered this as a bug and have logged a bug report for it. You can track its status from the below feedback link.
Feedback: https://www.syncfusion.com/feedback/37457/task-gets-deleted-while-resizing-multiple-taskbar
The fix will be provided in the patch release scheduled for September 14, 2022.
Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.
Regards,
Gopinath M
Hi Stephan,
Thank you for your patience.
The reported issue “Task gets deleted while resizing multiple taskbar” can be resolved in the sample level itself. We need to include the resources and taskType of the record also in the object passed to the updateRecordByID method. The below code snippets demonstrate the solution.
Index.js
actionComplete(args) { if (args.action == 'TaskbarEditing' && args.requestType == 'save' && !this.flag) { for (var i = 0; i < this.selectedrecords.length; i++) { if (args.data.TaskID == this.selectedrecords[i].TaskID) { this.selectedrecords.splice(i, 1); } } var data = { TaskID: this.selectedrecords[0].TaskID, StartDate: args.data.StartDate, Duration: args.data.Duration, resources: this.selectedrecords[0].ganttProperties.resourceInfo, taskType: 'FixedDuration', }; this.ganttInstance.updateRecordByID(data); this.flag = true; } }
|
Sample: https://stackblitz.com/edit/react-eepsja-oaqgfv?file=index.js
Regards,
Monisha.