Search code examples
telerikkendo-uikendo-scheduler

Kendo UI scheduler: make appointments that occur in the past 'read-only'


Is there a way to make appointments slots and grid cells that occur in the past read-only in the Kendo scheduler? It would be fantastic if the grid was editable, but only for slots that occur in the future.

I would like appointments that occurred in the past to not be movable, resizable or destroyable.

Ideally, I would still be able to double click on them to load my custom form as read-only so people can still view the details of the reservation. I would then use template logic to make those fields read-only.


Solution

  • Just a mock-up of how I would do it... you'll probably have to do that with all the previously mentioned events though.

    ---> outside your scheduler but still accessible to it
    var today = new Date(milliseconds);
    
    ---> events in your scheduler  - in this case the edit option...
    
    edit: function (e) {
    if (kendo.toString(e.event.end, "fff") < today ) {
        e.preventDefault();
        }
    else {
        console.log("Hope that helps?")
    }
    }
    

    Hope it helps!