I'm trying to get the number of visible columns (ListGridField) in a ListGrid.
Is there an easy solution for that?
Here's the solution using ListGrid.fieldIsVisible(String fieldName)
method:
private int getNumVisibleColumns(ListGrid grid) {
int count = 0;
for (ListGridField field : grid.getFields()) {
if (grid.fieldIsVisible(field.getName())) {
count++;
}
}
return count;
}
you can loop through the columns in the ListGrid and call ListGridField.getHidden() to count which ones are visible or not.