jQuery UI Widgets Forums Scheduler Can jqxScheduler prevent drag-drop across resources when user role is read-only

This topic contains 1 reply, has 2 voices, and was last updated by  admin 1 week, 3 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • sande
    Participant

    Hi everyone, I am working on a SaaS settings panel with Scheduler.

    I am currently trying to solve this: Can jqxScheduler prevent drag-drop across resources when user role is read-only for target resource?

    So far, I tried a couple of approaches from forum threads, but performance drops once the dataset grows.

    What would be the cleanest way to implement this?


    admin
    Keymaster

    Hi sande,

    The cleanest approach is to allow the drag interaction but reject the resource change in a single validation point—appointmentChange. jqxScheduler exposes this event after an appointment is modified, so you can compare the original and target resource and immediately revert unauthorized moves. This avoids expensive DOM checks during every drag frame and scales much better with larger datasets.
    app.unpkg.com
    +1

    A typical implementation looks like this:

    
    $('#scheduler').on('appointmentChange', function (event) {
        const appointment = event.args.appointment;
    
        const originalResource = appointment.originalResourceId;
        const targetResource = appointment.resourceId;
    
        if (!canMoveToResource(currentUser, targetResource)) {
            $('#scheduler').jqxScheduler(
                'setAppointmentProperty',
                appointment.id,
                'resourceId',
                originalResource
            );
        }
    });

    Regards,
    Peter

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.