Hi,
In a ListGrid, I'm trying to change dynamically the list of visible fields (columns).
The code that handles a visibility change looks like this:
Although several ClassCastExceptions are thrown, the grid is able to hide and display the fields as instructed, but I'm puzzled on why the exceptions occurred.
PS - I have tried the alternative grid.showField(name) and grid.hideField(name) but the performance of this solution is prohibitive. Changing all fields visibility at once takes a lot less time. The only way I have found to change all fields visibility at once is using grid.setFields(fields).
In a ListGrid, I'm trying to change dynamically the list of visible fields (columns).
The code that handles a visibility change looks like this:
Code:
ListGridField[] fields = grid.getDefaultFields(); for (ListGridField field : fields) { String name = field.getName(); field.setHidden(!visibleFields.contains(name)); } grid.setFields(fields); // this throws several ClassCastExceptions, but why!?
PS - I have tried the alternative grid.showField(name) and grid.hideField(name) but the performance of this solution is prohibitive. Changing all fields visibility at once takes a lot less time. The only way I have found to change all fields visibility at once is using grid.setFields(fields).