SmartGWTPro smartgwtpro 4.1 build 2014-07-18
dev mode & product mode
when using ListGridField.setOptionDataSource for valueMap mapping, we met a very strange problem, TestCase has been attached.
in a word, we have two fields for the same type valuemap mapping, for instance : userId -> userName
this mapping of this way works only for :
if you are using
it failed, both fields show the original value(userId)
however, it there is only one field which using the OptionDataSource for mapping, it did work too.
dev mode & product mode
when using ListGridField.setOptionDataSource for valueMap mapping, we met a very strange problem, TestCase has been attached.
in a word, we have two fields for the same type valuemap mapping, for instance : userId -> userName
this mapping of this way works only for :
Code:
ListGrid.setAutoFetchData(true)
Code:
grid.setAutoFetchData(false); grid.fetchData();
however, it there is only one field which using the OptionDataSource for mapping, it did work too.
Code:
...... public class TestEntryPoint implements EntryPoint { @Override public void onModuleLoad() { ListGrid grid = new ListGrid(); grid.setWidth("100%"); ListGridField f1 = new ListGridField("id1", "id1"); RestDataSource mds1 = new RestDataSource(); mds1.setDataFormat(DSDataFormat.JSON); mds1.setDataURL("http://localhost:9080/aries/map.json"); f1.setAutoFetchDisplayMap(true); f1.setValueField("k"); f1.setDisplayField("v"); f1.setOptionDataSource(mds1); ListGridField f2 = new ListGridField("id2", "id2"); RestDataSource mds2 = new RestDataSource(); mds2.setDataFormat(DSDataFormat.JSON); mds2.setDataURL("http://localhost:9080/aries/map.json"); f2.setAutoFetchDisplayMap(true); f2.setValueField("k"); f2.setDisplayField("v"); f2.setOptionDataSource(mds2); RestDataSource ds = new RestDataSource(); ds.setDataFormat(DSDataFormat.JSON); ds.setDataURL("http://localhost:9080/aries/ds.json"); grid.setDataSource(ds); // failed grid.setFields(f1, f2); grid.setAutoFetchData(false); grid.fetchData(); // works // grid.setFields(f1); // grid.setAutoFetchData(false); // grid.fetchData(); // works // grid.setFields(f1, f2); // grid.setAutoFetchData(true); grid.draw(); } }
Comment