Hi OneTx,
Thanks for using Syncfusion products.
We would like to let you know that, In Gantt control we can customize the Gantt columns with Check box (Boolean edit), combo box (Drop Down List) and String Textbox for links using LOAD client side event and column template.
Please refer the below code snippets for more details.
Code snippets:
<body> <form id="form1" runat="server" <ej:Gantt ID="Gantt" runat="server" //... Load="Load" BeginEdit="BeginEdit"> </ej:Gantt> <%--Column template for check box column--%> <script type="text/x-jsrender" id="customColumnTemplate1"> <div style="margin-left:20px;">{{if State}} <input class="customCheckbox" type="checkbox" checked="checked" value="" />{{else}} <input class="customCheckbox" type="checkbox" value="" />{{/if}}</div> </script> <%--Column template for Link column--%> <script type="text/x-jsrender" id="customColumnTemplate2"> <div style="margin-left:20px;">{{if Links}} <a rel='nofollow' href="{{:#data['Links']}}" target="_blank">Details</a>{{/if}}</div> </script> <script type="text/javascript"> //Sample Data for dropdown box var dropDownData = [ { text: "Open", value: "Open" }, { text: "Progress", value: "Progress" }, { text: "Testing", value: "Testing" }, { text: "Completed", value: "Completed" }]; function Load(args) { var columns = this.getColumns(); //Checkbox column with boolean edit columns.splice(2,0, { field: "State", headerText: "State", editType: "booleanedit", isTemplateColumn: true, templateID: "customColumnTemplate1", width: "80px", }); //Column with drop down list columns.splice(3, 0, { field: "TaskStatus", headerText: "Task Status", editType: "dropdownedit", mappingName: "TaskStatus", dropdownData: dropDownData, width: "180px", }); //Column with string edit for links columns.splice(4, 0, { field: "Links", headerText: "HyperLink", editType: "stringedit", mappingName: "Links", isTemplateColumn: true, templateID: "customColumnTemplate2", width: "180px", }); } //To block double click event on checkbox column function BeginEdit(args) { var columnIndex = args.columnIndex; if (columnIndex == 2) { args.cancel = true; } } //checked or unchecked checkbox and update the datasource $("#Gantt").on("change", ".customCheckbox", function (e) { var $tr = $(e.target).closest('tr'), ganttObj = $("#Gantt").data("ejGantt"), checkStatus = $(e.target).is(':checked'), rowIndex = ($tr).index(), record = ganttObj._currentViewData && ganttObj._currentViewData[rowIndex]; record["State"] = checkStatus; }); </script> </form> </body> |
We have also prepared a sample based on this and you can find the sample under the following location:
Sample: http://www.syncfusion.com/downloads/support/forum/118644/GanttCustomColumnLinks668864302.zip
Please let us know if you require further assistance on this.
Regards,
John R
Hi OneTx,
Thanks for the update.
We can also modify the code snippets of the column template as per your suggestion for rendering custom column with check box in Gantt control.
Please let us know if you require further assistance on this.
Regards,
John. R
Hi Sam,
Thanks for contacting Syncfusion support.
It is possible to load the custom drop down column with remote data in Gantt Control using “Load” client side event. Please refer the below code example for details.
<form id="form1" //…> <ej:Gantt ID="Gantt" runat="server" //… Load="load"> </ej:Gantt> <script type="text/javascript"> var projectResources = [ { resourceId: 1, resourceName: "Project Manager" }, { resourceId: 2, resourceName: "Software Analyst" }, { resourceId: 3, resourceName: "Developer" }, { resourceId: 4, resourceName: "Testing Engineer" } ]; var resourceData = ej.DataManager(projectResources).dataSource.json; //To load resource from remote server //ej.DataManager({url:"http://(service url)"}); // drop down data in JSON format. function load(args) { var columns = this.getColumns(); var columnData = { field: "DropDown", headerText: "DropDown", mappingName: "DropDown", editType: "dropdownedit", dropdownData: resourceData, editParams: { fields: { text: "resourceName", value: "resourceName" } } } columns.splice(2, 0, columnData); } </script> </form> |
Here we have referred the local ej.DataManager data as drop down data for custom column. Instead of the local data we can also pass the remote data in the ej.DataManager URL for oData as the drop down value. And which must be in JSON format. We have also prepared a sample based on this and you can find the sample under the following location.
Sample: http://www.syncfusion.com/downloads/support/forum/118644/ze/GanttDropDown-1565092718
Regards,
Mahalakshmi K.