问题
I'm trying to get the number of visible columns (ListGridField) in a ListGrid.
Is there an easy solution for that?
回答1:
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;
}
回答2:
you can loop through the columns in the ListGrid and call ListGridField.getHidden() to count which ones are visible or not.
来源:https://stackoverflow.com/questions/5787620/getting-the-number-of-visible-columns-in-a-listgrid-in-smartgwt