Hi Isomorphic,
please see this testcase (using v10.0p_2015-05-06):
For me, there are two fetches on ListGrid creation. This does not happen without the setSortByGroupFirst(true) call.
The requests are:
1st request (see endRow:457 and setGroupByMaxRecords(456) in the code):
2nd request (not needed):
I reported a similar bug, which is fixed, for 4.1p here.
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
Blama
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
Blama
Comment