Premium support for our pure JavaScript UI components


Post by jimmycallin »

Hi!

I'm experimenting with projectModel.applyChangeset to update the project model, and I'm having trouble applying changes to a tree store (resourceStore with tree set to true to be precise).

Here's a small example of what I'm trying to do. It properly adds the root node to the store, but not the children. Doing projectModel.resources = resourceData works perfectly, and I haven't found anything in the documentation saying I need to do anything in particular with children. Are you seeing any obvious issues?

Thanks!

projectModel.applyChangeset({
    "resources": {
        "added": [
            {
                "id": "36473c44-7cf2-11eb-a32d-861b18b6aec9",
                "name": "Napo",
                "eventColor": "#FFEB3B",
                "isParent": true,
                "expanded": true,
                "children": [
                    {
                        "id": "resource-task-row-36473c44-7cf2-11eb-a32d-861b18b6aec9",
                        "name": "task",
                        "eventColor": "#FFEB3B",
                        "groupTimelineBy": "default",
                        "subtitle": "",
                        "isChild": true,
                        "parentId": "36473c44-7cf2-11eb-a32d-861b18b6aec9"
                    }
                ],
            }
        ]
    }
})

Post by tasnim »

Hey,

I've tried to reproduce it here https://bryntum.com/products/schedulerpro/examples/flight-dispatch/, and it seems to be working fine.

Am I doing something wrong?

Attachments
msedge_VbjuAJpwpb.gif
msedge_VbjuAJpwpb.gif (123.73 KiB) Viewed 458 times

Post by jimmycallin »

Hi! I finally figured it out!

So we are first applying the first level while loading events, and then apply the second level (all children) on a second iteration when data has loaded. Once the first level has been loaded, you don't seem to be able to use the update property of applyChangeset to update a root resources to add children, but need to create them separately with a set parentId.

So this works, but I was a bit surprised by the behavior of children not being automatically added. Does this match with your understanding as well?


Post by ghulam.ghous »

Hey,

Thanks for sharing the insights and I have checked. We do not support loading children using the update method. The correct way is to use added as you have described:

Screenshot 2024-12-11 at 3.54.55 PM.png
Screenshot 2024-12-11 at 3.54.55 PM.png (139.62 KiB) Viewed 420 times

Post by jimmycallin »

Great! Would be nice with some documentation around this behavior :)

But we can close this, thanks!


Post Reply