Hello
I’m trying to set a select options by ajax before open the light box but it doesn’t work.
I would like to change dinamically the options of the lightbox select, but the options don’t change.
This is my code:
//DEFAULT alert_opts
var alert_opts = [
{ key: 1, label: 'None' },
{ key: 2, label: 'On start date' },
{ key: 3, label: '1 day before' }
];
scheduler.attachEvent("onBeforeLightbox", function (id){
alert_opts="";
val=scheduler.getEvent(id);
$.ajax({
url: "<?php echo CfgRoot; ?>/modules/planning/planning.php?mode=getProjects",
type: "POST",
dataType: "json",
async: false,
data: {iduser:val.section_id},
success : function(result){
// alert_opts=result.projectos;
var alert_opts = [
{ key: 1, label: 'Test1' },
{ key: 2, label: 'Test2' },
{ key: 3, label: 'Test3' }
];
}
});
return true;
});
scheduler.config.lightbox.sections=[
{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
{name:"Projectos", height:40, map_to:"alert_opts", type:"select", options:alert_opts},
{name:"time", height:72, type:"time", map_to:"auto"}
]
Or in a easy way, I would like to do something like this:
var alert_opts = [
{ key: 1, label: 'None' },
{ key: 2, label: 'On start date' },
{ key: 3, label: '1 day before' }
];
scheduler.attachEvent("onBeforeLightbox", function (id){
var alert_opts = [
{ key: 1, label: 'Test1' },
{ key: 2, label: 'Test2' },
{ key: 3, label: 'Test3' }
];
return true;
}
scheduler.config.lightbox.sections=[
{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
{name:"Projectos", height:40, map_to:"alert_opts", type:"select", options:alert_opts},
{name:"time", height:72, type:"time", map_to:"auto"}
]