Our pure JavaScript Scheduler component


Post by hltob »

We have own edit-, add- and delete dialogs. So we want to use them instead of using the build in.

Therefore I added the listeners to the config:

listeners: {
      beforeEventAdd({ eventRecord, resourceRecords }) {
        const evt = eventRecord.data;
        const grp = resourceRecords[0].data;
        // Prevent built in editor
        return false;
      },
      beforeEventEdit: ({ eventRecord, resourceRecord }) => {
        const evt = eventRecord.data;
        // Prevent built in editor
        return false;
      },
      beforeEventDelete: this.onDeleteConfirmation.bind(this),
<bryntum-scheduler-pro
          #scheduler
          [listeners] = "schedulerConfig.listeners"
          [eventEditFeature] = "true"
          [createEventOnDblClick] = "true"
          ...
</bryntum-scheduler-pro>

The delete- and add-callback are called once, but the edit-callback is called twice on double-click on a filled cell. The second time the resourceRecord-argument is undefined.


Post by tasnim »

Hi,

I tried to reproduce it with 5.3 and it seems to be working fine here.

Could you please upload a runnable test case so we can reproduce and debug it?


Post by Animal »

What do you see when you debug the Scheduler and look at the number of listeners that are added to it?
It should look like this with only one entry:

Screenshot 2023-03-17 at 16.55.06.png
Screenshot 2023-03-17 at 16.55.06.png (55.73 KiB) Viewed 187 times

Post by hltob »

@Animal I see only 1 listener. (attachment)

Attachments
scheduler-listeners-beforeventedit.PNG
scheduler-listeners-beforeventedit.PNG (15.13 KiB) Viewed 168 times

Post by hltob »

I can give you for each listener-call the "Call Stack"...
(take a look at the filenames)

Attachments
scheduler-onedit-second-time.PNG
scheduler-onedit-second-time.PNG (22.98 KiB) Viewed 168 times
scheduler-onedit-first-time.PNG
scheduler-onedit-first-time.PNG (23.93 KiB) Viewed 168 times

Post by hltob »

I found the causing line.

If I remove this line, the listener is called only once:

<bryntum-scheduler-pro
       ...
       [eventEditFeature] = "true"
       ...
</bryntum-scheduler-pro>

Post by alex.l »

Hi hltob,

Yes, looks like this might be the cause.
First, SchedulerPro uses taskEditFeature and not eventEditFeature. Second, it's enabled by default.

All the best,
Alex


Post Reply