Premium support for our pure JavaScript UI components


Post by alex.l »

Please use commit or project's acceptChanges.

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post by tomerPlanit »

Hi After I add the autoCommit to the store I get problems with assignments:

the code:

  ngAfterViewInit(): void {
        // Store Scheduler instance
        this.scheduler = this.schedulerComponent.instance;
        (this.scheduler.project.eventStore as EventStore).autoCommit=true;
        // (this.scheduler.project.resourceStore as ResourceStore).autoCommit=true;

    (this.scheduler.project.eventStore as EventStore).add(this.schedulerProps.events);
    (this.scheduler.project.resourceStore as ResourceStore).add(this.schedulerProps.resources);

   console.log((this.scheduler.project.eventStore as EventStore).getEventsForResource('r2'));


}

the console shows empty([]) and the resource has events.

3.png
3.png (4.25 KiB) Viewed 266 times

If I remove the event store auto commit all works fine.

Attachments
angular-18.rar
(108.32 KiB) Downloaded 17 times

Post by alex.l »

Hi,

Did you try recommended way? Why it's not an option for you? What's the goal to set autoCommit at runtime instead of set it initially or use API we suggested in previous messages?
I see you set autoCommit for eventStore only. I also don't see you set any assignments, as well as you loaded events before resources, so auto resolving in this situation is a race-condition: if no resource record with requested id available in ResourceStore, resourceId will be reset and assignment won't be created because of invalid linking. Best of all in case you used manual data, use AssignmentStore to avoid such problems. Or load resources first and use addAsync to make sure data added.

https://bryntum.com/products/scheduler/docs/api/Scheduler/data/mixin/EventStoreMixin#function-addAsync
Please also see https://bryntum.com/products/scheduler/docs/api/Scheduler/model/mixin/ProjectModelMixin#function-loadInlineData

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post by tomerPlanit »

I change the autoCommit to commit() on the store after finish the changes on the specific store.
Looks like works fine.
Is it the best practice?


Post by alex.l »

hi,

Best practice is to use data binding as we suggested in our guide. But if your business logic doesn't allow it, you can go like that, I do not see any objections, you will just take care of things by yourself, like these commits.

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post Reply