1. SmartClient Version: v10.0p_2015-04-22/LGPL Development Only (built 2015-04-22)
2. Firefox 24.8.0 on gentoo linux
Hi,
This is striped down test case with basic ListGrid displaying summary row, but summary record is requested from DataSource via lg.setSummaryRowDataSource(ds);
UnitDir.xml:
Running this example shows two requests/responses on the RPC tab: one for fetching grid's data and the second one fetching summary row. So far so good.
Now, pressing test button, which only resets viewState of the grid:
lg.setViewState(lg.getViewState());
shows identical 3 new requests/responses on RPC tab, each fetching summary record again and again.
Could it be corrected, as it stresses server in a real application (aggregation is sql costly).
Thanks,
MichalG
2. Firefox 24.8.0 on gentoo linux
Hi,
This is striped down test case with basic ListGrid displaying summary row, but summary record is requested from DataSource via lg.setSummaryRowDataSource(ds);
Code:
package pl.com.tech4.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.DOM; import com.smartgwt.client.data.DataSourceField; import com.smartgwt.client.data.RestDataSource; import com.smartgwt.client.data.fields.DataSourceFloatField; import com.smartgwt.client.data.fields.DataSourceTextField; 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.layout.VLayout; public class MainEntryPoint implements EntryPoint { public void onModuleLoad() { DOM.getElementById("loadingPicture").removeFromParent(); layout(); SC.showConsole(); } private void layout() { RestDataSource ds = new RestDataSource(); ds.setDataURL("UnitDir.xml"); DataSourceField fieldId = new DataSourceField(); fieldId.setName("id"); fieldId.setPrimaryKey(true); fieldId.setHidden(true); DataSourceTextField fieldCode = new DataSourceTextField(); fieldCode.setName("code"); DataSourceFloatField fieldValue = new DataSourceFloatField(); fieldValue.setName("value"); ds.setFields(fieldId, fieldCode, fieldValue); final ListGrid lg = new ListGrid(); lg.setDataSource(ds); lg.setAutoFetchData(true); lg.setShowGridSummary(true); lg.setSummaryRowDataSource(ds); IButton button = new IButton("test"); button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { lg.setViewState(lg.getViewState()); } }); VLayout layout = new VLayout(); layout.addMember(lg); layout.addMember(button); layout.draw(); } }
Code:
<response> <status>STATUS_SUCCESS</status> <startRow>0</startRow> <endRow>1</endRow> <totalRows>1</totalRows> <data> <UnitDir> <id>1</id> <code>kg</code> <value>5</value> </UnitDir> </data> </response>
Now, pressing test button, which only resets viewState of the grid:
lg.setViewState(lg.getViewState());
shows identical 3 new requests/responses on RPC tab, each fetching summary record again and again.
Could it be corrected, as it stresses server in a real application (aggregation is sql costly).
Thanks,
MichalG