I’m aware of how to put the scheduler in read only mode with the config options, but I’m wondering how to show the Lightbox in readonly mode for past events? Say I want to look at the details of an event that happened yesterday, but disable the ability to modify the event.
The only thing I have running in my demo now is the ability to edit current/future events. Viewing/editing past events is disabled completely.
Ideally I’d just like to be able to click/double click on a past event and view it.
Thanks,
Mike
Hello,
there is built-in tools for such behavior. But it can be done by the client-side code,
here is the sample[code]
function init(){
scheduler.attachEvent(“onBeforeLightbox”, function (id, mode, native_event) {
if (+scheduler.getEvent(id).start_date < +new Date())
scheduler.config.readonly_form = true;//readonly form for old events
else
scheduler.config.readonly_form = false;//regular form for others
return true;
});
scheduler.attachEvent(“onBeforeDrag”, function (id, mode, event) {
if (+scheduler.getActionData(event).date < +new Date())//forbid d’n’d in the past
return false;
return true;
});
var buttons = [“delete”, “edit”];
for (var i = 0; i < buttons.length; i++) {
var oldAction = scheduler._click.buttons[buttons[i]];
scheduler._click.buttons[buttons[i]] = function (id) {//disable ‘edit’ and ‘delete’ buttons for old events
if (+scheduler.getEvent(id).start_date < +new Date())
return;
else
oldAction.apply(scheduler, arguments);
};
}
}[/code]
on the server you need to include Readonly form extension, and call this code before scheduler initialization scheduler.Extensions.Add(SchedulerExtensions.Extension.Readonly);
scheduler.BeforeInit.Add("init()");