Post by shaveta »

Hi,

I have added a logic in my code to always write wbs value and sequence. It's working perfectly fine.
But when i delete tasks, these values are recalculated in UI, but never the tasks in store will be marked as updated. This is causing mismatch of WBS and sequence value between database and Gantt.

This can be easily reproduced in PHP example by deleting one of the task.

Any suggestion/patch to make it fix?


Post by saki »

There is https://bryntum.com/docs/gantt/#Gantt/model/TaskModel#function-refreshWbs that you can call with silent option turned off. This method is internally called when needed silently to prevent the records to be marked modified, however, you need just opposite.


Post by shaveta »

saki wrote: Wed May 19, 2021 9:53 am

There is https://bryntum.com/docs/gantt/#Gantt/model/TaskModel#function-refreshWbs that you can call with silent option turned off. This method is internally called when needed silently to prevent the records to be marked modified, however, you need just opposite.

Thanks!! It worked but with minor issue. I had tasks having below WBS value
1.1
1.2 (Removed 1.2)
1.3
1.4
1.4.1

Deleted the task 1.2, The WBS for 1st level tasks got update but 1.4.1 remains same when sending to server, it should be changed to 1.3.1

Also is there something like this for Sequence, i want to send updated sequence to server too?


Post by alex.l »

On what level do you call this method? To refresh wbs code for all the project, we suggest to call gantt.project.refreshWbs()

sequenceNumber should be updated automatically. What issues do you have with it?

All the best,
Alex

All the best,
Alex


Post by shaveta »

alex.l wrote: Wed May 19, 2021 12:54 pm

On what level do you call this method? To refresh wbs code for all the project, we suggest to call gantt.project.refreshWbs()

sequenceNumber should be updated automatically. What issues do you have with it?

All the best,
Alex

sequenceNumber is updating automatically in UI and works fine with add/update tasks.. But on delete tasks i am not getting updated value for this field when sending data for sync to server.

I have called refreshQbs. But one thing that i have noticed with new gantt version is it is not refreshing wbs value in UI. In the advanced gantt example i have tried below code in console and trigger "DeleteTask". But WBS value in UI remains same, it's modified behind the scenes

gantt.taskStore.on('update', () => {
        console.log('updated')
        gantt.project.firstChild.refreshWbs();
    });
scr.png
scr.png (129.11 KiB) Viewed 1691 times

Post by mats »

I have called refreshQbs.

Can you please show how you call refreshWbs after a delete operation? You need to listen to 'remove' event.


Post by shaveta »

mats wrote: Wed May 19, 2021 1:38 pm

I have called refreshQbs.

Can you please show how you call refreshWbs after a delete operation? You need to listen to 'remove' event.

My bad... i missed delete event.

Thanks Mats!!

For sequence number do you have something similar that will refresh sequence number for task in store on delete task?


Post by mats »

Not out of the box, but if you investigate the sources I'm sure it should be pretty obvious!


Post by shaveta »

mats wrote: Wed May 19, 2021 1:38 pm

I have called refreshQbs.

Can you please show how you call refreshWbs after a delete operation? You need to listen to 'remove' event.

gantt.taskStore.on('remove', () => {
        gantt.project.firstChild.refreshWbs();
    });

I don't see it refreshing WBS in UI, tried same in advanced gantt example.


Post by mats »

Ok try to debug it, step into the method and see what's going on there?


Post Reply