Our pure JavaScript Scheduler component


Post by Nagesh@Apoorva.com »

Hi,

How to Disable Previous Dates and Time without creating the schedule. Please find the below screenshots as a reference.

Attachments
DisableDates.png
DisableDates.png (69.21 KiB) Viewed 1036 times

Post by saki »

To disable dates in the event editor, install a listener:

    listeners : {
        beforeEventEditShow({ editor }) {
            const { widgetMap } = editor;
            widgetMap.startDateField.disabled = true;
            widgetMap.startTimeField.disabled = true;
            widgetMap.endDateField.disabled = true;
            widgetMap.endTimeField.disabled = true;
        }
    }

For D&D you could use one or all of:

Validation demo can also be used to study how to limit D&D operations: https://bryntum.com/examples/scheduler/validation/


Post by Nagesh@Apoorva.com »

Hi,
We didn't want to disable the date and time fields.

We want to disable creating a schedule for past dates, want to create a schedule for future dates only.
Please let us know how can we do it?


Post by saki »

There is currently no one-config way to disable past events. So it needs to be implemented where event can be created or edited or dragged or resized.

D&D operations you need the validator functions as above to prevent user from dragging/resizing events to the past.

For editing with editor you could implement https://bryntum.com/docs/scheduler-pro/#Scheduler/feature/EventEdit#event-beforeEventSave listener. This event is preventable by returning false from the listener so you can warn the user and prevent it or you can adjust start/end dates if set to past.


Post by Nagesh@Apoorva.com »

Hi,
Please let us any solution for this task?


Post by Nagesh@Apoorva.com »

#pmiklashevich Please let us any solution for this task.


Post by alex.l »

Hi Nagesh@Apoorva.com,

All you need is to implement your validation function (compare eventRecord.startDate with new Date() ?) using preventable event that Saki provided:
https://bryntum.com/docs/scheduler-pro/#Scheduler/feature/EventEdit#event-beforeEventSave

You could also apply https://bryntum.com/docs/scheduler-pro/#Core/widget/DateField#config-min you need to startDateField and endDateField fields in https://bryntum.com/docs/scheduler-pro/#Scheduler/feature/EventEdit#event-beforeEventEditShow listener.
It might be helpful to read this guide too:
https://bryntum.com/docs/scheduler/#Scheduler/guides/customization/eventedit.md#customizing-the-child-widgets

If you need help with development, please contact our Sales for Professional Services, we will be glad to help you: https://www.bryntum.com/services/

All the best,
Alex

All the best,
Alex


Post by Nagesh@Apoorva.com »

Thank you Customizing the child widgets are working.


Post Reply