Our pure JavaScript Scheduler component


Post by idyn-james »

Hello

When I want add a single Tree element, then I do the following:


      const parent = this._scheduler.resourceStore.getById(resource.parentId);
      parent.appendChild(resource);

And everything works as expected

What I do, when I want add a lot of tree data?

for instance something like this, throws an "record.parend undefined" exception

this._scheduler.resourceStore.add({ id : 1, name : 'ABBA', country : 'Sweden', children: [
            { id: 2, name: 'Agnetha' },
            { id: 3, name: 'Bjorn'},
            { id: 4, name: 'Benny'},
            { id: 5, name: 'Anni-Frid'}
        ]})

The "tree" Feature in the Scheduler Configuration is activiated.

Question: How I add set of tree data in the store?


Post by marcio »

Hey idyn-james,

I tested the second code in our tree demo https://www.bryntum.com/examples/scheduler/tree/ and worked correctly.

I saw in the first piece of code that you're using parentId, so could you confirm, are you using https://www.bryntum.com/docs/scheduler/api/Core/data/mixin/StoreTree#config-transformFlatData
??

If yes, you need to add children like it's described in the documentation, all items on the same level, and using the parentId property to map the tree structure.

[
  { id : 1, name : 'Parent' },
  { id : 2, name : 'Child', parentId : 1 }
]

Could you please share how your Scheduler configuration looks like??

Best regards,
Márcio


Post Reply