Articles in this section
Category / Section

How to show or hide the columns in Gantt?

1 min read

In jQuery 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.

Sample

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