SMART datagrid v.1 > Examples

Back  Forward

Column Visibility  Example

You can use GridColumn.visible property to hide or display the column. 

Code -1
    $('#toggle').click = function () {
        var col = grid.columnByName('country');
        col.setVisible(!col.visible());
    };

GridColumn.displayIndex has the display location of column, and if hidden, it will have the value less than 0. And, you can set displayIndex to change the display location, specify -1 to hide it, or specify the value greater than 0 to display the hidden column again. 

GridColumn.index is the location of column specified when it is added to the grid, and it will be maintained regardless of display state. 

Grid - 1
rows

Columns: , index: 0  

Column Groups: , index: 0  

View Source JSP 

See Also
GridColumn.visible
GridColumn.displayIndex
GridColumn.index
Examples
Column Grouping
Column Moving