Hi Isomorphic,
using v12.1p_2022-08-10 and retesting it with v12.1p_2023-06-27 I noticed some problems in my application with ListGrid grouping and setSummaryRowDataSource().
#1: Check "Aggregate?": The summaryRow is displayed all over and no data is displayed (see screenshot).
#2: Check "Aggregate?" and "Group at start?": Same, plus the aggregation request is sent twice (so four in total: Normal 0-1000 (OK), Normal 0-75 (OK), 2x Agg (1x expected)
All the other options are there to test more special cases, as I thought it also related to aggregation-request timing.
Please see the attached testcase.
Best regards
Blama
BuiltInDS.java:
SupplyItem.java:
supplyItem.ds.xml addition:
using v12.1p_2022-08-10 and retesting it with v12.1p_2023-06-27 I noticed some problems in my application with ListGrid grouping and setSummaryRowDataSource().
#1: Check "Aggregate?": The summaryRow is displayed all over and no data is displayed (see screenshot).
#2: Check "Aggregate?" and "Group at start?": Same, plus the aggregation request is sent twice (so four in total: Normal 0-1000 (OK), Normal 0-75 (OK), 2x Agg (1x expected)
All the other options are there to test more special cases, as I thought it also related to aggregation-request timing.
Please see the attached testcase.
Best regards
Blama
BuiltInDS.java:
Code:
package com.smartgwt.sample.client;
import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.Version;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.data.AdvancedCriteria;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.GroupStartOpen;
import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.types.SummaryFunctionType;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
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 {
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();
}
});
VLayout mainLayout = new VLayout(20) {
{
setWidth100();
setHeight100();
DynamicForm confDF = new DynamicForm();
confDF.setNumCols(1);
confDF.setWidth(250);
CheckboxItem groupAtStart = new CheckboxItem("groupAtStart", "Group at start?");
groupAtStart.setDefaultValue(false);
CheckboxItem lessThan1000 = new CheckboxItem("lessThan1000", "Less than 1000 records?");
lessThan1000.setDefaultValue(false);
CheckboxItem showGridAgg = new CheckboxItem("showGridAgg", "Aggregate?");
showGridAgg.setDefaultValue(false);
CheckboxItem aggSlowCBI = new CheckboxItem("aggSlow", "Aggregation slow?");
aggSlowCBI.setDefaultValue(false);
CheckboxItem fetchSlowCBI = new CheckboxItem("fetchSlow", "Normal fetch slow?");
fetchSlowCBI.setDefaultValue(false);
ButtonItem start = new ButtonItem("btn", "Open Window");
start.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
@Override
public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
recreate((Boolean) confDF.getValue("aggSlow"), (Boolean) confDF.getValue("fetchSlow"), (Boolean) confDF.getValue("showGridAgg"),
(Boolean) confDF.getValue("groupAtStart"), (Boolean) confDF.getValue("lessThan1000"));
}
});
confDF.setFields(groupAtStart, lessThan1000, showGridAgg, aggSlowCBI, fetchSlowCBI, start);
addMembers(confDF);
}
};
mainLayout.draw();
}
private void recreate(boolean aggSlow, boolean fetchSlow, boolean showGridAgg, boolean groupAtStart, boolean lessThan1000) {
Window w = new Window();
w.setWidth("95%");
w.setHeight("95%");
w.setMembersMargin(0);
w.setModalMaskOpacity(70);
w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
w.setTitle("12.1p Problem with ListGrid grouping and setSummaryRowDataSource()" + w.getTitle());
w.setShowMinimizeButton(false);
w.setIsModal(true);
w.setShowModalMask(true);
w.centerInPage();
final ListGrid listGrid = new ListGrid(DataSource.get("supplyItem")) {
{
setHeight100();
setAutoFetchData(true);
if (groupAtStart) {
setGroupByField("category");
}
if (lessThan1000) {
setInitialCriteria(new AdvancedCriteria("itemName", OperatorId.LESS_OR_EQUAL, "D"));
}
setSortByGroupFirst(true);
setShowGroupSummary(true);
setGroupStartOpen(GroupStartOpen.ALL);
setSortField("itemName");
setShowFilterEditor(true);
if (showGridAgg) {
setShowGridSummary(true);
}
setSummaryRowDataSource(DataSource.get("supplyItem"));
if (fetchSlow) {
setFetchOperation("fetchSlow");
}
setSummaryRowFetchRequestProperties(new DSRequest() {
{
if (aggSlow)
setOperationId("fetchAggSlow");
else
setOperationId("fetchAgg");
}
});
ListGridField itemID = new ListGridField("itemID");
itemID.setSummaryFunction(SummaryFunctionType.SUM);
ListGridField itemName = new ListGridField("itemName");
ListGridField SKU = new ListGridField("SKU");
ListGridField category = new ListGridField("category");
ListGridField units = new ListGridField("units");
ListGridField unitCost = new ListGridField("unitCost");
unitCost.setSummaryFunction(SummaryFunctionType.AVG);
ListGridField inStock = new ListGridField("inStock");
setFields(itemID, itemName, SKU, category, units, unitCost, inStock);
}
};
HLayout btnLayout = new HLayout(10);
btnLayout.setPadding(5);
btnLayout.addMembers(new IButton("No filter", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
listGrid.fetchData();
}
}), new IButton("<1000 entries", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
listGrid.fetchData(new AdvancedCriteria("itemName", OperatorId.LESS_OR_EQUAL, "D"));
}
}), new IButton("Group ListGrid", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
listGrid.groupBy("category");
}
}));
VLayout vLayout = new VLayout(10) {
{
addMembers(btnLayout, listGrid);
}
};
w.addItem(vLayout);
w.show();
}
}
Code:
package com.smartgwt.sample.server.listener;
import javax.servlet.http.HttpServletRequest;
import com.isomorphic.datasource.DSRequest;
import com.isomorphic.datasource.DSResponse;
public class SupplyItem {
public DSResponse fetchSlow(DSRequest request, HttpServletRequest servletRequest) throws Exception {
Thread.sleep(500);
return request.execute();
}
};
Code:
<serverObject lookupStyle="new" className="com.smartgwt.sample.server.listener.SupplyItem" />
<operationBindings>
<operationBinding operationType="fetch" operationId="fetchSlow" serverMethod="fetchSlow" />
<operationBinding operationType="fetch" operationId="fetchAgg">
<selectClause>SUM(itemID) as itemID, AVG(unitCost) AS unitCost</selectClause>
</operationBinding>
<operationBinding operationType="fetch" operationId="fetchAggSlow" serverMethod="fetchSlow">
<selectClause>SUM(itemID) as itemID, AVG(unitCost) AS unitCost</selectClause>
</operationBinding>
</operationBindings>
Comment