In Gantt, we can hide or show the columns using hideColumn and showColumn public methods. We need to call these methods using the column’s header text as parameter. It is not possible to hide the tree/expander column by default. The following code snippet explains how to hide/show the column at an external button click event. <button id="hidecolumn">Hide Task Name field</button> <button id="showcolumn">Show Task Name field</button> <div id="gantt" style="position: absolute; height:550px; width:1300px"></div> <script type="text/javascript"> $(function () { $("#gantt").ejGantt({ treeColumnIndex:3, //... }); }); $("#hidecolumn").click(function () { var ganttObj = $("#gantt").data("ejGantt"); ganttObj.hideColumn("Task Name"); }); $("#showcolumn").click(function () { ganttObj = $("#gantt").data("ejGantt"); ganttObj.showColumn("Task Name") }); </script> Sample: A sample to hide or show a column in the button click event is available in the following link. |
This page will automatically be redirected to the sign-in page in 10 seconds.