Version: SmartGWT 3.1p nightly January.
When setting viewstate before displaying listgrid, valuemaps of fields with optiondatasource are not fetched automaticly.
This is because in ListGrid.js there is a problem:
ListGrid.js@14753:
The completefields are null at this moment, thus method setFields is called. setFields triggers _setOptionDataSources which sets the valuemap requests up. It sets the field _fetchValueMap to true ,so when the listgrid is painted, the valuemaps are actually retrieved.
So far so good, if at least _fetchValueMap is not changed.
Then when you look again at ListGrid.js@14771
the method refreshFields is called, which in return calls setFields, which calls _setOptionDataSources, which set _fetchValueMap to null and for sane reasons does not add the valuemap request again.
Now the actual paint is being called, _fetchValueMap is null and no valuemaps are retrieved!
Workaround:
Overwrite setViewState in ListGrid with the following code:
When setting viewstate before displaying listgrid, valuemaps of fields with optiondatasource are not fetched automaticly.
This is because in ListGrid.js there is a problem:
ListGrid.js@14753:
The completefields are null at this moment, thus method setFields is called. setFields triggers _setOptionDataSources which sets the valuemap requests up. It sets the field _fetchValueMap to true ,so when the listgrid is painted, the valuemaps are actually retrieved.
So far so good, if at least _fetchValueMap is not changed.
Then when you look again at ListGrid.js@14771
the method refreshFields is called, which in return calls setFields, which calls _setOptionDataSources, which set _fetchValueMap to null and for sane reasons does not add the valuemap request again.
Now the actual paint is being called, _fetchValueMap is null and no valuemaps are retrieved!
Workaround:
Overwrite setViewState in ListGrid with the following code:
Code:
@Override
public void setViewState(String viewState) {
super.setViewState(viewState);
resetFetchValueMap();
}
public native void resetFetchValueMap()/*-{
var self = this.@com.smartgwt.client.widgets.BaseWidget::getOrCreateJsObj()();
self._fetchValueMap=true;
}-*/;