Premium support for our pure JavaScript UI components


Post by snath »

I want to prevent the dummy event getting created on right click and on clicking Add event as shown below.

Screenshot 2022-11-16 165849.png
Screenshot 2022-11-16 165849.png (497 Bytes) Viewed 350 times
Screenshot 2022-11-16 165828.png
Screenshot 2022-11-16 165828.png (2.41 KiB) Viewed 350 times

Currently we have also set the taskEdit to false as we want to display our custom editor. Is there an event that we can listen to on click of Add Event click where we can trigger our custom popup?

We tried adding the following code.

schedulerConfig.listeners = {
        beforeEventAdd: (event) => {
            this.openAddEvent();
            return false;
        }
     } 

But this impacts drag to create event flow.

Using Scheduler Pro 5.2.1


Post by alex.l »

Please check the guide how to replace Task Editor https://bryntum.com/docs/scheduler-pro/guide/SchedulerPro/basics/taskedit#replacing-the-task-editor

It shows how to handle all cases you mentioned.

All the best,
Alex


Post by snath »

Thank you! This is what we were looking for.
But we see that we do not have access to any of the resourceRecord data against which an event is created. Is there a way to access the resource record for that row in beforeTaskEdit method?


Post by alex.l »

All the best,
Alex


Post by snath »

Thanks!
One last question in this thread. How can I delete the dummy event that gets created?

I tried the following

beforeTaskEdit({ taskRecord, taskElement }) {
           taskElement.remove();
}

It removes the event initially, but it re-appers again after the next "Add Event" trigger. (Either by drag to create or Right click to Add).


Post by tasnim »

How can I delete the dummy event that gets created?

Could you please explain in detail when you want to delete an event? how the behavior will look like?


Post by snath »

Sorry if I was not clear, what I meant by dummy event is the provisional event that gets created on Drag to Create. So on the Custom popup when I click on Cancel, I would like this provisional event to be deleted. How can I achieve this?


Post by tasnim »

You just need to listen for the cancel button click. and when it is clicked you just need to remove the taskRecord

taskReocrd.remove();

That's all you need
Good Luck :),
Tasnim


Post by snath »

Thank you Tasnim :)


Post Reply