Sarwar
August 23, 2023, 12:38pm
#1
I need to create radio/checkbox field from the task data/properties, how could I do do that? Anyone?
Need something like
gantt.config.lightbox.sections = [
{name:"description", height:38, map_to:"text", type:"textarea", focus:true},
{name:"users",type:"radio", map_to:"users", options:getUsers(task_id)},
{name:"time", height:72, type:"duration", map_to:"auto"}
];
My plan is, If Im able to pass the task_id to getUsers() then it will return the options array; is this a correct way?
ramil
August 24, 2023, 1:50pm
#2
Hello Sarwar,
When you set options
for the lightbox section, it is a static array. Gantt will build a form using it and won’t update it even if you change the values in the array.
If you want to change the array, you need to use the resetLightbox
method to rebuild the form.
Or you can create the serverList
array:
https://docs.dhtmlx.com/gantt/api__gantt_serverlist.html
Then you can modify its values with the updateCollection
method:
https://docs.dhtmlx.com/gantt/api__gantt_updatecollection.html
After that, Gantt will rebuild the lightbox form. If the lightbox is open at that time, it will be closed.
You can modify the array with the options in the onBeforeLightbox
event handler:
https://docs.dhtmlx.com/gantt/api__gantt_onbeforelightbox_event.html
Here is an example of how it can be implemented:
https://snippet.dhtmlx.com/oq9yfjk0
Sarwar
August 25, 2023, 12:38pm
#3
Thanks a lot @ramil it helped! Cheers!
1 Like