I am trying to get the number of visible columns in ListGrid and came across the same problem in this question :-
However this does not work. Here is my code:-
ListGridField firstName=new ListGridField("firstName","First Name");
ListGridField lastName=new ListGridField("lastName","Last Name");
ListGridField companyName=new ListGridField("companyName","Company Name");
ListGridField companyNameHidden=new ListGridField("companyNameHidden","Company Name");
firstName.setWidth(200);
lastName.setWidth(200);
companyName.setWidth(200);
companyNameHidden.setWidth(200);
companyNameHidden.setHidden(true);
listGrid.setFields(firstName,lastName,companyName,companyNameHidden);
for(ListGridField fieldName:listGrid.getFields()){
System.out.println(fieldName.getName()+"======="+listGrid.fieldIsVisible(fieldName.getName()));
}
The output is :-
firstName=======true
lastName=======true
companyName=======true
companyNameHidden=======true
Shouldn't it be false for last one. The field is clearly hidden. Please suggest how to find number of visible fields, of a ListGrid.