How could I make the entire column that doesn't contain any



How could I make the entire column that doesn’t contain any values in its cells not visible?



This is the header : ,Image,Reference ID,Client,Bridges (for road bridges alos tick ‘road’, heavy rail bridges ‘heavy rail’, etc �.),#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,Segmental bridges,#cspan,Cable stayed bridges,#cspan,#cspan,Environment,#cspan,Front-end servicesE,#cspan,#cspan,ecological analysis and this is the XML contain :
[ … data skipped …]



I need the columns length, Height,…(and all the empty columns) to not appear


You can use



grid.setColumnHidden(index,true)
or
grid.setColumnsVisibility(list)



commands to hide show any column or list of columns
This command must be executed after grid.init



Please beware, that in case of colspans in header, you need to hide|show all columns included in colspan at once

If you want to hide it automatically, if the content is empty, do the following steps:

- save the label of the column inside a variable (getColumnLabel)
- set label to an empty string
- save the current width of the column inside a variable (getColWidth)
- perform adjustColumnSize
- check, if width is smaller than 3 pixel, if yes, then there is no content inside
- now you can set label (setColumnLabel) and width (setColWidth) back and depending on your decision hide the column (setColumnHidden)

if the content is empty, do the following steps
The next code may be a bit more simple way to detect is column empty or not

var empty=true;
mygrid.forEachRow(function(id){
    if (mygrid.cells(id,index).getValue()) empty=false;
});