Custom column which is a checkbox


I have previously asked a question about this but it got a little jumbled so I thought i would start a new thread

I have been able to add custom columns to the gantt chart but only text boxes. I can see from the documentation that I could add a select too.

However I would reallly like to be able to add a checkbox custom column. By this I mean that it would display a checkbox in the lightbox form but on the actual task list it would show the checkbox selected value (e.g. yes for checked or not for not checked as an example)

I know i could achieve this with a select with 2 options but I would much prefer a checkbox.

Any examples would be much appreciated


the current version of the component does not include a checkbox control for the lightbox. However, it can be implemented easily.
The code (checkbox definition, grid and lightbox configuration) might look like following:[code]//simple checkbox control
render:function(config) {
return “”;
node.checked = !!value;
return !!node.checked;

//grid configuration
{name:“text”, label:“Task name”, tree:true},
{name:“start_date”, label:“Start time”, align: “center” },
{name:“duration”, label:“Duration”, align: “center” },
{name:“checked”, label:“Checked”, template:function(task){
return “checked”;
} else{
return “not checked”;
} }
//lightbox configuration
gantt.config.lightbox.sections = [
{name: “description”, height: 70, map_to: “text”, type: “textarea”, focus: true},
{name:“check”, type:“checkbox”, map_to:“checked_task”},
{name: “time”, height: 72, type: “duration”, map_to: “auto”}
gantt.locale.labels.section_check = “Checkbox”;
gantt.init(“gantt_here”);[/code] … lumns.html … _form.html … ditor.html

hello advance… i’ve some problem too with checkbox… i’am adding checkbox on specify column not in lightbox. but, when i’am checked the checkbox form and i’am click other checkbox, the checkbox back to “not checked”… … lumns.html

this is my code

gantt.config.columns = [

            {name:"text", tree:true, resize:true ,"label":"[[TASK]]",width:'*'},

            {name:"start_date", align: "center" ,"label":"[[START]]" ,width:'*', template:function(date){ 

                return convert_date(gantt.templates.tooltip_date_format(date.start_date));



            {name:"duration", align: "center","label":"[[DAY]]",width:'*' },

           {name:"checked", label:"Checked", template:function(task){
                 return "<input type='checkbox' name='test' id='test' value='1'>";


thx advance… sorry, my english is bad .

I have the same trouble with checkboxes.

Anybody could solve this?

you need to bind the state of a checkbox you render to the state of the task - make it checked/unchecked depending on a certain property of the task object, and change that property of the task when user checks or unchecks the checkbox, there shouldn’t be any issues with that :

gantt.config.columns = [
  {name:"text", tree:true, resize:true ,"label":"[[TASK]]",width:150},
  {name:"start_date", align: "center" ,"label":"[[START]]" ,width:90},
  {name:"duration", align: "center","label":"[[DAY]]",width:50 },
  {name:"checked", label:"Checked", template:function(task){
    var checked = !!task.checked ? " checked" : "";
    return "<input class='gantt-checkbox-column' type='checkbox' name='test' id='test' value='1' " +
       checked+ "/>";

gantt.attachEvent("onTaskClick", function(id, e){
   var checkbox = gantt.utils.dom.closest(, ".gantt-checkbox-column");
    checkbox.checked = !!checkbox.checked;
    gantt.getTask(id).checked = checkbox.checked;
    return false;
   return true; 

1 Like

hi, is it possible to add two checkbox in one column with different values (i.e. value=1 and value=2). and when i check the checkbox with value=2 a text box should appear either in a separate column or in the same column.

Hello Tewad,
It is possible to display any HTML elements inside the grid by using the template function:
However, each time Gantt repaints the changes, it will create new HTML elements in the grid, so you need to save the radiobox state in the task property.
Here is an example of how it might be implemented: