Hi Dev,
We are using Bryntum Gantt and Schedular pro in a SPA, we have an issue while setting data to the ProjectModel. The data is fetched through Ajax and set to the ProjectModel like below
let newProject = new ProjectModel({ ...projectConfig}),
stores = [
"timeRangeStore",
"calendarManagerStore",
"resourceStore",
"eventStore",
"assignmentStore",
"dependencyStore",
];
newProject.on("dataready", function (e) {
if (newProject.stm.disabled) {
newProject.stm.enable();
newProject.stm.autoRecord = true;
}
if (oldProject && !oldProject.isDestroyed) {
oldProject.removeAllListeners();
oldProject.destroy();
}
});
stores.forEach((storeName) => {
let store = newProject[storeName],
storeId = store.id;
console.log(storeName);
if (data[storeId]) {
store.add(data[storeId]);
}
});
setProject(newProject);
As you can see above we are creating a new projectModel. If we use the same project model we are getting some other issue like Id collision.
Once we set the data on the second time we are getting the below error.
Kindle suggest us the better way to handle setting and getting data from Project model. We are not using the REST API backend instead we are using GraphQL to fetch the data and save the modified data from stores.