Hi Isomorphic,
this is solved for me using v10.0p_2015-06-11.
Best regards
Blama
Announcement
Collapse
No announcement yet.
X
-
This seems to have been unrelated to the original post, but is resolved in current nightly builds.
Leave a comment:
-
Hi Isomorphic,
this does work (v10.0p_2015-05-21) as the ListGrid is sorted afterwards, but the request issued for the click on "Recreate with setSortState"-button does not have any sortBy-information.
This is also true when uncommenting
Code:// setSortByGroupFirst(true);
Code:sortBy:[ "status", "status", "-diet" ],
Best regards
Blama
Leave a comment:
-
We've made another change to address that behavior as well. Present in nightly builds dated May 21 or later.
Leave a comment:
-
Hi Isomorphic,
I can confirm that with today's nightly the issue in the testcase is gone. Unfortunately the testcase does not show the setup in my application, which reveals another bug in this area.
Please see the revised testcase. It seems that setGroupByField() does not work well with setSortState(). The ListGrid is grouped then, but not sorted. See this on click on the "Recreate with setSortState"-button.
If you comment out the setGroupByField() call, sorting via setSortState() works as well.
I played around with the order of calls, but did not get a correct result.
Code:package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.SortSpecifier; import com.smartgwt.client.types.SortDirection; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout vL; private TestGrid tG; private HLayout hL; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); vL = new VLayout(5); vL.setPadding(20); vL.setWidth100(); vL.setHeight100(); tG = new TestGrid(false); hL = new HLayout(5); IButton reloadSetSort = new IButton("Recreate with setSort"); reloadSetSort.setWidth(150); reloadSetSort.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { vL.removeChild(tG); tG.markForRedraw(); tG = new TestGrid(false); vL.addMember(tG, 0); } }); IButton reloadSetSortState = new IButton("Recreate with setSortState"); reloadSetSortState.setWidth(150); reloadSetSortState.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { vL.removeChild(tG); tG.markForRedraw(); tG = new TestGrid(true); vL.addMember(tG, 0); } }); IButton getConfig = new IButton("Get ViewState"); getConfig.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { SC.say("<b>GroupState:</b><br/>" + tG.getGroupState() + "<br/><br/><b>SortState:</b><br/>" + tG.getSortState() + "<br/><br/><b>FieldState:</b><br/>" + tG.getFieldState()); } }); IButton invalidateCache = new IButton("Invalidate Cache"); invalidateCache.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { tG.invalidateCache(); } }); hL.addMembers(reloadSetSort, reloadSetSortState, getConfig, invalidateCache); vL.addMembers(tG, hL); vL.draw(); } private class TestGrid extends ListGrid { public TestGrid(boolean useSortState) { super(DataSource.get("animals")); setAutoFetchData(false); setCanSort(true); ListGridField commonName = new ListGridField("commonName"); ListGridField scientificName = new ListGridField("scientificName"); ListGridField lifeSpan = new ListGridField("lifeSpan"); ListGridField status = new ListGridField("status"); ListGridField diet = new ListGridField("diet"); ListGridField information = new ListGridField("information"); // Comment setGroupByField() to see setSortState() working setGroupByField(status.getName()); // setSortByGroupFirst(true); setFields(commonName, scientificName, lifeSpan, status, diet, information); if (useSortState) setSortState("({fieldName:\"lifeSpan\",sortDir:\"ascending\",sortSpecifiers:[{property:\"lifeSpan\",direction:\"ascending\"},{property:\"diet\",direction:\"descending\"}]})"); else setSort(new SortSpecifier[] { new SortSpecifier(lifeSpan.getName(), SortDirection.ASCENDING), new SortSpecifier(diet.getName(), SortDirection.DESCENDING) }); // fetchData(new AdvancedCriteria(new Criterion("commonName", OperatorId.NOT_NULL))); fetchData(); } } }
Best regards
Blama
Leave a comment:
-
Thanks for the report, and for the test case. This should be resolved in the next nightly build (5/14/2015).
Leave a comment:
-
Bug (double fetch) with new ListGrid setting setSortByGroupFirst(true)
Hi Isomorphic,
please see this testcase (using v10.0p_2015-05-06):
Code:package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.SortSpecifier; import com.smartgwt.client.types.SortDirection; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout vL; private TestGrid tG; private HLayout hL; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); vL = new VLayout(5); vL.setTop(20); vL.setLeft(20); vL.setWidth100(); vL.setHeight100(); tG = new TestGrid(); hL = new HLayout(5); IButton reload = new IButton("Reload"); reload.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { vL.removeChild(tG); tG.markForRedraw(); tG = new TestGrid(); vL.addMember(tG, 0); } }); IButton getConfig = new IButton("Get ViewState"); getConfig.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { SC.say(tG.getViewState()); } }); hL.addMembers(reload, getConfig); vL.addMembers(tG, hL); vL.draw(); } private class TestGrid extends ListGrid { public TestGrid() { super(DataSource.get("animals")); setAutoFetchData(false); setCanSort(true); setGroupByMaxRecords(456); ListGridField commonName = new ListGridField("commonName"); ListGridField scientificName = new ListGridField("scientificName"); ListGridField lifeSpan = new ListGridField("lifeSpan"); ListGridField status = new ListGridField("status"); ListGridField diet = new ListGridField("diet"); ListGridField information = new ListGridField("information"); setGroupByField(status.getName()); setSortByGroupFirst(true); setFields(commonName, scientificName, lifeSpan, status, diet, information); setSort(new SortSpecifier[] { new SortSpecifier(lifeSpan.getName(), SortDirection.ASCENDING), new SortSpecifier(diet.getName(), SortDirection.DESCENDING) }); fetchData(); } } }
The requests are:
1st request (see endRow:457 and setGroupByMaxRecords(456) in the code):
Code:{ dataSource:"animals", operationType:"fetch", componentId:"isc_BuiltInDS_TestGrid_5", data:{ }, startRow:0, endRow:457, sortBy:[ "status", "lifeSpan", "-diet" ], textMatchStyle:"exact", resultSet:[ResultSet ID:isc_ResultSet_5 (dataSource: animals, created by: isc_BuiltInDS_TestGrid_5)], callback:{ caller:[ResultSet ID:isc_ResultSet_5 (dataSource: animals, created by: isc_BuiltInDS_TestGrid_5)], methodName:"fetchRemoteDataReply" }, willHandleError:true, showPrompt:true, prompt:"Finding Records that match your criteria...", oldValues:{ }, requestId:"animals$6279", internalClientContext:{ requestIndex:1 }, fallbackToEval:false, lastClientEventThreadCode:"MUP8", bypassCache:true }
Code:{ dataSource:"animals", operationType:"fetch", componentId:"isc_BuiltInDS_TestGrid_5", data:{ }, startRow:0, endRow:75, sortBy:[ "status", "lifeSpan", "-diet" ], textMatchStyle:"exact", resultSet:[ResultSet ID:isc_ResultSet_5 (dataSource: animals, created by: isc_BuiltInDS_TestGrid_5)], callback:{ caller:[ResultSet ID:isc_ResultSet_5 (dataSource: animals, created by: isc_BuiltInDS_TestGrid_5)], methodName:"fetchRemoteDataReply" }, willHandleError:true, showPrompt:true, prompt:"Finding Records that match your criteria...", oldValues:{ }, requestId:"animals$62710", internalClientContext:{ requestIndex:2 }, fallbackToEval:false, lastClientEventThreadCode:"TMR0", bypassCache:true }
I also remember getting a log entry in the Developer Console like (from memory) "The ResultSet for ListGrid xyz was discarded while ..." back then. I do not get this message now.
Best regards
BlamaTags: None
Leave a comment: