scheduler lightbox changing

hi



I’m trying to change the lightbox displayed from the scheduler based on details in the event itself. I’m doing it from the clicked and double clicked event but its not working and throws an error. I have version 2.1



code as follows





in the setup code

        //events

        scheduler.attachEvent(“onClick”,change_lightbox);

        scheduler.attachEvent(“onDblClick”,change_lightbox);





function change_lightbox(id){

    var ev = this.getEvent(id);

    //change what can be seen if an aggregate event

    if (ev.aggregate == ‘Y’)

        scheduler.config.lightbox.sections=[    

                 { name:“my_aggregate”, height:200, map_to:“text”, type:“my_desc” , focus:true}

                 //{ name:“execs”, height:200, map_to:“text”, type:“my_execs” , focus:false},

                 //{ name:“time”, height:72, type:“time”, map_to:“auto”}    

             ];    

    else

        scheduler.config.lightbox.sections=[    

                     { name:“description”, height:200, map_to:“text”, type:“my_desc” , focus:true},

                     { name:“execs”, height:200, map_to:“text”, type:“my_execs” , focus:false},

                     { name:“time”, height:72, type:“time”, map_to:“auto”}    

                 ];    



    return true;

}


Hello,


you can try to use the following approach:


/ scheduler.attachEvent(“onClick”,change_lightbox);
scheduler.attachEvent(“onDblClick”,change_lightbox);
/


scheduler.attachEvent(“onBeforeLightbox”,change_lightbox);


function change_lightbox(id){
var ev = this.getEvent(id);
if (ev.aggregate == ‘Y’)
scheduler.config.lightbox.sections=[
{ name:“my_aggregate”, height:200, map_to:“text”, type:“my_desc” , focus:true}
];
else
scheduler.config.lightbox.sections=[
{ name:“description”, height:200, map_to:“text”, type:“my_desc” , focus:true},
{ name:“execs”, height:200, map_to:“text”, type:“my_execs” , focus:false},
{ name:“time”, height:72, type:“time”, map_to:“auto”}
];
scheduler._lightbox = null;
return true;
}




That works, thanks.



Just one additional question, is there a way to turn off the save and delete buttons and just leave the cancel button maybe renamed ‘close’/



 



Jeremy


It is possible. Please see the sample dhtmlxScheduler/samples/03_extensions/14_readonly_event.html.


But solution provided in the previous answer won’t work with readonly extension.


I saw this dhtmlxScheduler/doc/html/dhtmlxscheduler/dhtmlxscheduler___behaviors.html which allows for a readonly attribute in the event - in my case, I’m doing this in XML to load the schedule



It sort of works a couple of times then fails. This is with the code to show different lightboxes



J


Try to move the scheduler.attachEvent(“onBeforeLightbox”,change_lightbox); handler after init method call. Locally it’s solved the issue with readonly extension.