Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Dec 15, 2009 02:57
open dhtmlx forum
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;
}
Answer posted by Alex (support) on Dec 15, 2009 04:09

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; 
}

Answer posted by jeremymarshall@arbuthnot.co.uk on Dec 15, 2009 05:59

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

Answer posted by Alex (support) on Dec 15, 2009 06:04

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. 

Answer posted by jeremymarshall@arbuthnot.co.uk on Dec 15, 2009 07:50

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

Answer posted by Alex (support) on Dec 15, 2009 08:01

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