Reload lightbox section [resolved]

Hi,

I’ve got a specific lightbox-section called ‘group’, as follows:

//load the ‘group’ options
var listgroup=sendRequestGet(“processAjax.php”,“actevent=11”,“no_control”,0);
var group=eval(listgroup);

var sectionsAreaX="[{name:‘description’, height:50, map_to:‘text’, type:‘textarea’ , focus:true},{name:‘group’, height:23, type:‘select’, options:group, map_to:‘group_id’ }, {name:‘recurring’,height:115,type:‘recurring’,map_to:‘rec_type’,button:‘recurring’},
{name:‘time’, height:72, type:‘time’, map_to:‘auto’}]";

scheduler.config.lightbox.sections=eval(sectionsAreaX);

This code works fine, that’s the situation: I’ve written a combobox which gives the possibility to insert new records into the ‘group’ option, so, the end-user can to add new records at group list. The database is updated in the background, using ajax request, the new data certainly are recorded in database.

My question: How to re-build the lightbox section, then the new record could to appear on the list, my idea:

scheduler.attachEvent(“onEventCreated”,function(id){
//CODE TO RELOAD THE LIGHTBOX SECTIONS
return true;});

…i haven’t figured out how to do it, i had tried using “scheduler.clearAll” and “scheduler.load(url);”, but anyway, the section was not reloaded(still the list on the database is already updated).

My problem is, i got to keep the database up-to-date, but i don’t know how to reload the section ‘group’ that i’ve created at the beggining…

Sorry by my bad english(i’m from Brazil) and, thanks in advance.

Jack

Hello,

the list of options is set only once, by render method, and this list isn’t updated automatically. You can modify set_value method of the “select” block and add the option to the select.

For example the following method adds new option to the select when the details form opens:

var setter = scheduler.form_blocks.select.set_value;

scheduler.form_blocks.select.set_value = function(){
setter.apply(this,arguments)
var grops_select = document.getElementsByTagName(“select”)[0];
grops_select.options[grops_select.options.length] = new Option(“new option”,“new”);
}

thanks, it works!