Articles in this section
Category / Section

How to customize the dialog fields in Gantt

2 mins read

In Gantt control, user can enable or disable required fields in both edit dialog and add dialog, for both the predefined and custom columns using editDialogFields and addDialogFields properties. The fields displayed in the editDialogFields and addDialogFields properties alone will be displayed in the Gantt dialogs.

Please refer the following code snippets for more details.

Code snippets:

<body style="overflow: hidden; position: static; margin: 0; padding: 0;">
<div id="gantt" style="position: absolute; height:450px; width:1300px"></div>    
    <script type="text/javascript">       
       $(function () {
           $("#gantt").ejGantt({
                load:"load",
                //...
                addDialogFields: [
                    { field: "Id" },
                    { field: "Name" },
                    { field: "startDate" },
                    { field: "Duration" }
    ],
                editDialogFields: [
                    { field: "Name" },
                    { field: "StartDate" },
                    { field: "ExpectedDate" } //To display custom column
    ],
            
            });
        });
        function load(args) {
            var columns = this.getColumns();
            columns.splice(2, 0,
                {
                    field: "ExpectedDate",
                    headerText: "Expected Date ",
                    editType: "stringedit",
                    mappingName: "ExpectedDate", //Provide this mapping name
                    width: "180px"
                });   
        }
    </script>
</body>
 

The following screen shots shows the output of the above code snippets.

Add Dialog: (General Tab)

Customize the add dialog fields.

Edit Dialog: (General Tab)Customize the general tab fields of edit dialog.

Edit Dialog: (Tab for custom column)

Customize the custom tab fields of edit dialog.

 

 

DisplayInGeneralTab:

The “displayInGeneralTab” property in edit dialog and add dialog fields is required to provide the support for displaying the fields of custom columns in the General tab of dialog box. By default the value of this property will be false.

In the above edit dialog box, to display the field of “ExpectedDate” custom column in General Tab, the following code snippets can be used in “editDialogFields” property.

Code snippets:

//...
   editDialogFields: [
        { field: "Name" },
        { field: "StartDate" },
        { field: "ExpectedDate", displayInGeneralTab: true } //To display this custom column field in General Tab
    ],
//...

The following screen shots shows the output of the above code snippets.

Edit dialog with custom column field in general tab.

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