Premium support for our pure JavaScript UI components


Post by tomerPlanit »

Hi I am using scheduler 5.2.2v with angular 13.

I want to move event to another resource by change the "resourceId" parameter.

After the change the event moves to the destination resource(in second click) but when I look on the event's resourceId parameter the value inside is the previous resource id.

I create demo that based on yours angular 11 demo 5.2.4v, I add some dummy resource and add button that move all events to this resource.

moveToDummy() {
        this.scheduler.eventStore.beginBatch();
        this.scheduler.eventStore.getRange().forEach((event: EventModel) => {
            event.resourceId = 'r0';
        });
        this.scheduler.eventStore.endBatch();
        setTimeout(() => {
            console.log(this.scheduler.eventStore.getRange().map((event: EventModel) => {
                return { eventName: event.name, resource: event.resourceId };
            }));
        }, 3000);
    }

And listen to event click event that print event's resource id:

 onEventClick(event){
        console.log(event.eventRecord.resourceId);
    }

Dummy resource id is "r0"

in the consoles you can see that the resource id is the previous resource id and not the current:

2.png
2.png (232.83 KiB) Viewed 595 times

For reproduce:

angular-11-routing.rar
(21.59 MiB) Downloaded 54 times

1) Click on the custom button that move the jobs(first click not work don't know why) twice.
2) See the console after 3 seconds will print the new state.
3) Click on the event you will see in the console the resource id.

I did something wrong?


Post by tomerPlanit »

This is a very critical bug because my whole system uses your parameters and now I can't trust them because I don't know if all the other parameters have changed.


Post by alex.l »

Could you please check if you can build and run your application? I see many deprecation warnings and an error after that.

Error: Error on worker #1: Error: Debug Failure. Unhandled SyntaxKind: Unknown.
    at pipelineEmitWithHintWorker (/angular-11-routing/node_modules/typescript/lib/typescript.js:114177:22)
    at pipelineEmitWithHint (/angular-11-routing/node_modules/typescript/lib/typescript.js:113708:17)
    at pipelineEmitWithComments (/angular-11-routing/node_modules/typescript/lib/typescript.js:117396:13)
    at pipelineEmit (/angular-11-routing/node_modules/typescript/lib/typescript.js:113648:13)
    at emit (/angular-11-routing/node_modules/typescript/lib/typescript.js:113621:13)
    at emitParameter (/angular-11-routing/node_modules/typescript/lib/typescript.js:114414:13)
    at pipelineEmitWithHintWorker (/angular-11-routing/node_modules/typescript/lib/typescript.js:113757:32)
    at pipelineEmitWithHint (/angular-11-routing/node_modules/typescript/lib/typescript.js:113708:17)
    at pipelineEmitWithComments (/angular-11-routing/node_modules/typescript/lib/typescript.js:117396:13)
    at pipelineEmit (/angular-11-routing/node_modules/typescript/lib/typescript.js:113648:13)
    at ClusterMaster.onWorkerMessage (file:///angular-11-routing/node_modules/@angular/compiler-cli/bundles/chunk-OU6PTAY7.js:1464:15)
    at file:///angular-11-routing/node_modules/@angular/compiler-cli/bundles/chunk-OU6PTAY7.js:1374:71
    at EventEmitter.<anonymous> (file:///angular-11-routing/node_modules/@angular/compiler-cli/bundles/chunk-OU6PTAY7.js:1532:15)
    at EventEmitter.emit (node:events:527:28)
    at Worker.<anonymous> (node:internal/cluster/primary:186:13)
    at Worker.emit (node:events:527:28)
    at ChildProcess.<anonymous> (node:internal/cluster/worker:33:12)
    at ChildProcess.emit (node:events:527:28)
    at emit (node:internal/child_process:938:14)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)
/angular-11-routing/node_modules/@ngtools/webpack/src/ngcc_processor.js:135
            throw new Error(errorMessage + `NGCC failed${errorMessage ? ', see above' : ''}.`);
                  ^

Error: NGCC failed.
    at NgccProcessor.process (/angular-11-routing/node_modules/@ngtools/webpack/src/ngcc_processor.js:135:19)
    at /angular-11-routing/node_modules/@ngtools/webpack/src/ivy/plugin.js:147:27
    at Hook.eval [as call] (eval at create (/angular-11-routing/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:24:1)
    at Hook.CALL_DELEGATE [as _call] (/angular-11-routing/node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (/angular-11-routing/node_modules/webpack/lib/Compiler.js:1108:30)
    at /angular-11-routing/node_modules/webpack/lib/Compiler.js:1153:29
    at eval (eval at create (/angular-11-routing/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)

But the thing I see is that you are trying to assign many events to one resource in single-assignment mode.
Please check docs https://bryntum.com/products/scheduler/docs/api/Scheduler/model/mixin/EventModelMixin#field-resourceId

Id of the resource this event is associated with (only usable for single assignments). We recommend using assignments in an AssignmentStore over this approach. Internally any Event using resourceId will have an assignment in AssignmentStore generated.

For multi-assignment mode please fill in https://bryntum.com/products/scheduler/docs/api/Scheduler/view/SchedulerBase#config-assignmentStore
https://bryntum.com/products/scheduler/docs/api/Scheduler/data/AssignmentStore
Here is an example https://bryntum.com/products/scheduler/examples/multiassign/

All the best,
Alex


Post by tomerPlanit »

Hi Alex,
The demo is in angular 13 and not 11.
You need to run npm i and I work with nodeJS 16.13.2.


Post by alex.l »

angular-11-routing is the name of the folder you sent. I just run npm i and it uses versions you specified.
Did you review and fix moments I mentioned in my previous post? I don't see the need to do troubleshooting with the app before you fixed that.

All the best,
Alex


Post by tomerPlanit »

Hi alex,
I create a new demo based on the original angular 11 example as is only move the logic, and add button that move one event to the dummy resource and change the event name also.
When you will click on this event after a move you will see that the name changed but the resource not in the console.

Attachments
angular-11-routing.rar
(361.94 KiB) Downloaded 43 times

Post by alex.l »

Thank you for the test case

The problem here is same as I described above. This code

moveAllToDummy() {
        this.scheduler.eventStore.beginBatch();
        this.scheduler.eventStore.getRange().forEach((event: EventModel) => {
            event.resourceId = 'r0';
        });
        this.scheduler.eventStore.endBatch();
        setTimeout(() => {
            console.log('After move console:');
            console.log(this.scheduler.eventStore.getRange().map((event: EventModel) => {
                return { eventName: event.name, resource: event.resourceId };
            }));
        }, 3000);
    }

is trying to assign many events to one resource in single-assignment mode.
Please check docs https://bryntum.com/products/scheduler/docs/api/Scheduler/model/mixin/EventModelMixin#field-resourceId

Id of the resource this event is associated with (only usable for single assignments). We recommend using assignments in an AssignmentStore over this approach. Internally any Event using resourceId will have an assignment in AssignmentStore generated.

For multi-assignment mode please fill in https://bryntum.com/products/scheduler/docs/api/Scheduler/view/SchedulerBase#config-assignmentStore
Scheduler.data.AssignmentStore and don't use resourceId approach
Here is an example https://bryntum.com/products/scheduler/examples/multiassign/

https://bryntum.com/products/scheduler/docs/api/Scheduler/model/EventModel#function-assign
https://bryntum.com/products/scheduler/docs/api/Scheduler/data/AssignmentStore#function-add

All the best,
Alex


Post Reply