I would like to ask if it is possible to make lightbox readonly for all events in the timeline view except for one section so that events in that section would remain editable? (existing events)
Also, is it possible to show lightbox only if the empty space in that section was double clicked and not to show for other sections? (adding new event)
You can catch double click on event bar and switch form to readonly when it’s necessary
It also can be done by catching the related events of the scheduler.
You will need three of them -
onDblClick - to switch readonly lightbox
onBeforeDrag, onEmptyClick - to prevent resizing and adding new events on double click.
The code might be following[code] var editableSection = 1;
//readonly form
scheduler.attachEvent("onDblClick", function(id){
if(id && scheduler.getEvent(id)){
var ev = scheduler.getEvent(id);
if(ev.section_id == editableSection){
scheduler.config.readonly_form = false;
}else{
scheduler.config.readonly_form = true;
}
}
return true;
});
//resize and create by dragging area
scheduler.attachEvent("onBeforeDrag", function (event_id, mode, e){
return (scheduler.getActionData(e).section == editableSection);
});
//double-click on empty space
scheduler.attachEvent("onEmptyClick", function (date, e){
var section = scheduler.getActionData(e).section;
if(section == editableSection){
scheduler.config.dblclick_create = true;
}else{
scheduler.config.dblclick_create = false;
}
});[/code]
Thanks for your reply Aliaksandr,
Your code works just fine in timeline view, however it also modifies the behaviour of day, week and month views. In these views I was unable to add new event.
Could you modify your code, so that it only works in timeline view, please?
Thank you
Hi,
try something like this:[code]function isTimelineView(){ //scheduler.matrix stores configurations of all timelines, added to the scheduler
//so, if current view is found in this container - then it’s timeline
return !!scheduler.matrix[scheduler.getState().mode];
}
var editableSection = 1;
//readonly form
scheduler.attachEvent(“onDblClick”, function(id){
if(!isTimelineView()) return true;