Our pure JavaScript Scheduler component


Post by dbennett »

hi, how can I disable closing (autoClose, the close button, clicking out) when an async process is running via the event editor submit btn?


Post by marcio »

Hey dbennett,

Thanks for reaching out.

To prevent the EventEditor from closing while an async process is running, you can override the default behavior of the submit button. You can achieve this by listening to the beforeComplete event and returning false to veto the completion until your async process is finished. Here's a basic example:

scheduler.eventEdit.on('beforeComplete', async ({ context }) => {
    // Start your async process
    const result = await yourAsyncFunction();

    // If the async process is successful, allow completion
    if (result) {
        context.finalize(true);
    } else {
        // Prevent closing if the async process fails
        return false;
    }
});

This way, the editor will remain open until your async process completes successfully.

Documentation reference: https://bryntum.com/products/schedulerpro/docs/api/Core/widget/Editor#event-beforeComplete.

Best regards,
Márcio

How to ask for help? Please read our Support Policy


Post by Animal »

You probably want the editor to be modal if it has to stay up there and be unclosable.

But you want to disable the bbar buttons, [SAVE] [DELETE] and [CANCEL]?

Probably during the async process, do

editor.disabled = 'inert';

Which makes the whole editor unresponsive to user input and pointer gestures.

And when the process completes do

editor.disabled = false;

Post by dbennett »

"editor.disabled = 'inert';" doesn't seem to do anything. can you provide a whole code snippet, from the root scheduler config?


Post by Animal »

You have to get a reference to the EventEditor widget itself. I assumed you had that:

myScheduler.features.eventEdit.editor.disabled = 'inert';

Post Reply