Articles in this section
Category / Section

How to add custom column and custom edit dialog fields in resource view Gantt

1 min read

In Resource view Gantt, we can add custom column in grid part and, we can add custom fields in task add/edit dialog. This can be done by using load event, getColumn and getResourceViewEditColumns methods. The below code example shows how to add custom column in grid part and custom field in add/edit dialogs.

<div id="resourceGantt" style="height:450px;width:100%;" />
 
<script type="text/javascript">
$(function () {
    $("#resourceGantt").ejGantt({
         dataSource: resourceGanttData,
         //...
         load: function () {
             this.getColumns()[0].width = 180;
             var customColumn = {
                 field: "taskCount",
                 mappingName: "taskCount",
                 allowEditing: false,
                 headerText: "Task Count",
                 isTemplateColumn: true,
                 template: "{{if eResourceTaskType=='resourceTask'}} <span style='padding:10px;'> {{:eResourceChildTasks.length}}</span> {{/if}}"
              };
              this.getColumns().push(customColumn);
              var customTaskColumn= {field:"customColumn", mappingName:"customColumn", headerText:"Custom Column", editType:"numericedit"};
              this.getResourceViewEditColumns().push(customTaskColumn);
         }
    });
});
</script>

 

The below screenshot depicts the output of above code example.

Add custom column in gantt resource view.

Resource view Gantt with custom column

Add custom column fields in gantt resource view.

Task edit dialog with custom field

A sample to add custom column and custom fields in resource view Gantt is available here

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied