Our pure JavaScript Scheduler component


Post by jmeire »

Hi

I use the angular scheduler, the resources are structured in a tree.
But for example on a button click a want to refresh the child nodes of a parent.
Is this possible?

Already tried the load children but this ends up in an Id collision because the original children are still there.
Then I tried to first use the removeChild method but that didn't work. Should the children also visually be gone in the scheduler when using removeChild?

What is the best approach to do this?

Kind regards
jmeire

Post by mats »

But for example on a button click a want to refresh the child nodes of a parent.
What's the reason for the need of a manual refresh? Has the data changed? If data changes the view is refreshed automatically.

On a separate topic, looks like your trial is expired so we'll need you to license our software to continue receiving support. Please reach out to sales [at] bryntum to arrange this.

Post by jmeire »

Hi

A license is currently being requested. Thank you for the support so far, it has been a great help!

The reason for the manual refresh is sorting and filtering, but the sorting and happens in the back end of my application because it is complex and depends on multiple entities that are not included in the data that we uses for the resources of the scheduler tree.

So for example if i click a 'filter' button --> this should completely refetch the children.

Load children requires the children to be removed first I guess because otherwise there will be an Id collision.

Post by mats »

Load children requires the children to be removed first I guess because otherwise there will be an Id collision.
Loading new data takes care of removing old data, and refreshing the view. It's not something you have to worry about.

Post by jmeire »

Okay then I must do something wrong because I get an Id collision when refreshing children.
I added an example project, and a preview of the issue as a gif.
YmZ1n4t4o7.gif
YmZ1n4t4o7.gif (173.64 KiB) Viewed 1972 times
When you click the refresh children button, this triggers a loadChildren of the expanded nodes.
this.resourceStore.loadChildren(resource);
LoadChildren should handle this correctly but it triggers an id collision error.

How can I handle the refresh of the children correctly?

Example project:
refreshChildren.zip
(17.29 MiB) Downloaded 89 times
Thanks in advance!

Post by sergey.maltsev »

Hi!

Try removing children before you load them again otherwise you would receive Id collision errors because same rows are added twice.
    if (resourcesToBeSorted && resourcesToBeSorted.length > 0) {
      resourcesToBeSorted.forEach((resource: any) => {
        this.resourceStore.remove(resource.children);
        this.resourceStore.loadChildren(resource);
      });
    }

Also save/load expanded/collapsed row states before/after this operation.
See sample code for this here
viewtopic.php?p=69107#p69135

Post by sergey.maltsev »

Created issue to get it fixed
https://github.com/bryntum/support/issues/491

Post by jmeire »

Okay, thank you!

Post Reply