Hi,
Our datasources are generated server side. The order in which the datasource fields are in the datasource is just
as we generate them (so no particular order).
The fields in the listgrid should be displayed in a particular order for one window and as our
datasources are re-used on multiple "windows", the order and which fields we show can be different.
I tried re-ordering the fields via ListGrid.reorderField(fieldNum, moveToPosition);
However, it's not working... probably because I'm moving all my ListGridFields in one go, is that correct?
Is there another way to re-order the bound fields?
Don't want to use setFields explicitly as I get from the javadoc that that's not a good idea when using setDataSources as well.
It would be nice if you could set the actual field order on initialisation.
Our datasources are generated server side. The order in which the datasource fields are in the datasource is just
as we generate them (so no particular order).
The fields in the listgrid should be displayed in a particular order for one window and as our
datasources are re-used on multiple "windows", the order and which fields we show can be different.
I tried re-ordering the fields via ListGrid.reorderField(fieldNum, moveToPosition);
However, it's not working... probably because I'm moving all my ListGridFields in one go, is that correct?
Is there another way to re-order the bound fields?
Don't want to use setFields explicitly as I get from the javadoc that that's not a good idea when using setDataSources as well.
It would be nice if you could set the actual field order on initialisation.
Code:
//partiesFieldOrder is a static list of 10 field names which correspond to fields that are in the datasource //datasource actually contains many more fields ListGrid partiesGrid = new ListGrid(); partiesGrid.setWidth100(); partiesGrid.setDataSource(involvedparty);//generated datasource partiesGrid.setSelectionType(SelectionStyle.SINGLE); partiesGrid.setVisible(false);//hide for now... //draw (grid is still hidden) but needed for the getAllFields (to apply the datasource) partiesGrid.draw(); ListGridField[] gridFields = partiesGrid.getAllFields(); for(int i=0; i < gridFields.length; i++){ //set actual fields to show => otherwise everything is shown partiesGrid.hideField(gridFields[i].getName()); for(int x=0; x < partiesFieldOrder.length; x++){ if(gridFields[i].getName().equalsIgnoreCase(partiesFieldOrder[x])){ partiesGrid.showField(gridFields[i].getName()); partiesGrid.reorderField(i, x);//this isn't working continue; } } } partiesGrid.markForRedraw(); partiesGrid.show();//now show the grid (already drawn)
Originally posted by javadoc
Comment