Our powerful JS Calendar component


Post by SemFA »

Hello,

I have a ChainedStore. I chain it by doing this:

const chainedStore = calendar.crudManager.eventStore.chain(
	(record) => record.state === "unplanned",
);

grid.store = chainedStore;

This works great. However, I'm having issues with updating records from the grid.store.

When I do this:

const records = grid.selectedRecords;

records.forEach((record) => {
	record.set("state", "canceled");
});

It doesn't call an update on the crudManager url. It does update the store and remove all records from the grid.store.

if I instead do this:

const records = grid.selectedRecords;

records.forEach((record) => {
	record.set("state", "planned");
	record.set("state", "canceled");
});

Then it works, because setting it to "planned" puts it back in the eventStore and then changing it to canceled calls our API.

However, this solution is very slow, as it seems to recalculate all selectedRecords into the calendar, and then remove them again because we put the state to "canceled".

So my question is, is it possible to change a property of a record in the ChainedStore and make crudManager update it? And if not, how would you suggest we do this?


Post by tasnim »

Hi,

To make the curdManager react on chained store you'd need to add it as a crud-store of crudManager.
Please use this function to add it to crudManager https://bryntum.com/products/calendar/docs/api/Scheduler/crud/AbstractCrudManagerMixin#function-addCrudStore

calendar.curdManager.addCrudStore(chainedStore)

Hope it helps.

Best regards,
Tasnim


Post Reply