I have a ListGrid which shows a subset of the fields defined in the DataSource, so I use setFields( ... ); for selecting them.
I used to have the setFields(...) in the constructor of the ListGrid, until I noticed a very strange behaviour.
When the ListGrid caller calls "listGrid.setCanExpandRecords( true );", the ListGrid shows EVERY FIELD in the DataSource! So the "setFields(...)" is totally ignored.
If I remove the "listGrid.setCanExpandRecords( true )", the listGrid shows only the fields defined in "setFields(...)", so a correct behaviour.
The only way I solved this was not calling "setFields(...)" in the constructor, but in a normal method of the ListGrid. Then everything works fine. But this is not normal... could this be a bug?
Using SmartGWT 3.0p EE
Edit:
I think this must be a bug. I isolated the problem:
The constructor:
So I set the fields there.
If I leave the "//lg.setCanExpandRecords( true );" line as a comment, I see everything ok, as you see in my first screenshot. The fields defined are there.
But if I write "lg.setCanExpandRecords( true );", the fields defined are IGNORED and EVERY SINGLE field of my DataSource is beeing shown (screenshot 2).
I used to have the setFields(...) in the constructor of the ListGrid, until I noticed a very strange behaviour.
When the ListGrid caller calls "listGrid.setCanExpandRecords( true );", the ListGrid shows EVERY FIELD in the DataSource! So the "setFields(...)" is totally ignored.
If I remove the "listGrid.setCanExpandRecords( true )", the listGrid shows only the fields defined in "setFields(...)", so a correct behaviour.
The only way I solved this was not calling "setFields(...)" in the constructor, but in a normal method of the ListGrid. Then everything works fine. But this is not normal... could this be a bug?
Using SmartGWT 3.0p EE
Edit:
I think this must be a bug. I isolated the problem:
Code:
public void onModuleLoad() { SchuelerListGrid lg = new SchuelerListGrid(null,false); lg.setWidth( "100%" ); lg.setHeight( "100%" ); lg.fetchData(); //lg.setCanExpandRecords( true ); lg.draw(); }
Code:
public SchuelerListGrid( OpenSchuelerManager osm, boolean allowCellBaseStyle ) { super(); this.osm = osm; this.allowCellBaseStyle = allowCellBaseStyle; //setLoadingDataMessage( "${loadingImage} " + Zedes2.getConstants().loadingMessage() ); setShowAllRecords( false ); setAutoFetchData( false ); setCanEdit( false ); setShowFilterEditor( true ); setFilterOnKeypress( true ); setFetchDelay( 500 ); setSelectionType( SelectionStyle.NONE ); setComponentSort(); setDataSource( DataSource.get( "schueler" ) ); //setComponentFields(); schuelerIdField = new ListGridField( "f_schueler_id" ); schuelerIdField.setHidden( true ); nameField = new ListGridField( "f_name", "name" ); nameField.setShowHover( false ); nameField.setWidth( "50%"); vornameField = new ListGridField( "f_vorname", "vorname" ); vornameField.setShowHover( false ); vornameField.setWidth("50%"); gebDatumField = new ListGridField( "f_geb_datum", "geb" ); gebDatumField.setShowHover( false ); gebDatumField.setWidth( 100 ); ListGridField geschwisterGruppeField = new ListGridField( "geschwister_gruppe" ); geschwisterGruppeField.setHidden( true ); setFields( schuelerIdField, nameField, vornameField, gebDatumField, geschwisterGruppeField ); }
If I leave the "//lg.setCanExpandRecords( true );" line as a comment, I see everything ok, as you see in my first screenshot. The fields defined are there.
But if I write "lg.setCanExpandRecords( true );", the fields defined are IGNORED and EVERY SINGLE field of my DataSource is beeing shown (screenshot 2).
Comment