Hello! I came across a small issue while I tried to change our resource column structure from flat data to tree data. It should look like as in the tree demo: https://bryntum.com/examples/examples-scheduler/tree. It should have 3 levels as a tree (publisher -> team -> id). I manually added parentId-s where its needed so that the transformFlatData should work as in the examples
When I try to run the code, I got the following error:
Id collision on DC,JUSTICE_LEAGUE,DC,MARVEL,AVENGERS,MARVEL
Used Bryntum Scheduler Pro version: 5.0.4
The flat data coming from backend:
const rotations = [
{ id: 'DC JUSTICE_LEAGUE BATMAN', publisher: 'DC', team: 'JUSTICE_LEAGUE'},
{ id: 'DC JUSTICE_LEAGUE SUPERMAN', publisher: 'DC', team: 'JUSTICE_LEAGUE'},
{ id: 'DC JUSTICE_SOCIETY DRFATE', publisher: 'DC', team: 'JUSTICE_SOCIETY'},
{ id: 'MARVEL AVENGERS IRONMANN', publisher: 'MARVEL', team: 'AVENGERS'},
{ id: 'MARVEL AVENGERS THOR', publisher: 'MARVEL', team: 'AVENGERS' },
{ id: 'MARVEL THUNDERBOLTS USAGENT', publisher: 'MARVEL', team: 'THUNDERBOLTS' },
];
column.js
const columns = [
{
type: 'tree',
tree: true,
text: 'L{Column.rotation}',
field: 'publisher',
];
export default columns;
ResourceStore.js
import { ResourceStore as SchedulerResourceStore } from '@bryntum/schedulerpro';
class ResourceStore extends SchedulerResourceStore {
transformFlatData = true;
tree = true;
fields = ['publisher', 'team', 'id'];
/**
* @public
*/
loadData(rawData) {
super.loadDataAsync(rawData);
}
}
export default ResourceStore;
resourceData.js
const newRotations = [];
for (const rotation of rotations) {
newRotations.push(
{ id: rotation.publisher, name: rotation.publisher, field: 'publisher', parentId: null },
{ id: rotation.team, name: rotation.team, field: 'team', parentId: rotation.publisher },
{
id: rotation.id,
name: rotation.id,
field: 'id',
parentId: rotation.team,
},
);
}
resourceStore.loadData(newRotations);
Scheduler.js
<BryntumSchedulerPro
...
columns={columns}
treeFeature={true}
treeGroupFeature={{
levels: ['publisher', 'team', 'id'],
}}
Could you please help me with what is wrong exactly and how to fix it?