Hi Isomorphic,
I noticed a strange issue when accidentally using fetchData() with Criteria instead of AdvancedCriteria and manually filtering afterwards.
Trying to create a testcase before noticing the mistake, I found this different behavior fetchData(advancedCriteria) and setInitialCriteria(advancedCriteria) with v11.1p_2017-12-05.
In this BuiltInDS-based testcase, the inital fetches are textMatchStyle:"substring" for initalCriteria and textMatchStyle:"exact" for fetchData().
The fetches itself are fine and the same, which is expected.
Further filtering for "Ad" in the Item column issues a request in the 1st ListGrid (loaded with fetchData()) but does not in the 2nd (loaded with initalCriteria and autofetchData), which does client-side filtering.
I don't see the reason for this and would expect both filter actions to be client side only.
Perhaps the error is only the used textMatchStyle. Here I don't know why they differ.
BuiltInDS.java:
Best regards
Blama
I noticed a strange issue when accidentally using fetchData() with Criteria instead of AdvancedCriteria and manually filtering afterwards.
Trying to create a testcase before noticing the mistake, I found this different behavior fetchData(advancedCriteria) and setInitialCriteria(advancedCriteria) with v11.1p_2017-12-05.
In this BuiltInDS-based testcase, the inital fetches are textMatchStyle:"substring" for initalCriteria and textMatchStyle:"exact" for fetchData().
The fetches itself are fine and the same, which is expected.
Further filtering for "Ad" in the Item column issues a request in the 1st ListGrid (loaded with fetchData()) but does not in the 2nd (loaded with initalCriteria and autofetchData), which does client-side filtering.
I don't see the reason for this and would expect both filter actions to be client side only.
Perhaps the error is only the used textMatchStyle. Here I don't know why they differ.
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.DataSource; import com.smartgwt.client.data.SortSpecifier; import com.smartgwt.client.types.OperatorId; import com.smartgwt.client.types.SortDirection; 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.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout mainLayout; private IButton recreateBtn; 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(); } }); mainLayout = new VLayout(20); mainLayout.setWidth100(); mainLayout.setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(); } }); mainLayout.addMember(recreateBtn); recreate(); mainLayout.draw(); } private void recreate() { Window w = new Window(); w.setWidth("50%"); w.setHeight("50%"); w.setMembersMargin(0); w.setModalMaskOpacity(70); w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); w.setTitle("ListGrid fetches differ when using fetchDate() or initialCriteria" + w.getTitle()); w.setShowMinimizeButton(false); w.setIsModal(true); w.setShowModalMask(true); w.centerInPage(); final ListGrid supplyItemLG = new SupplyItemListGrid(); final ListGrid supplyItem2LG = new SupplyItemListGrid(); supplyItem2LG.setInitialCriteria(new AdvancedCriteria("unitCost", OperatorId.EQUALS, 0.41F)); supplyItem2LG.setAutoFetchData(true); w.addItem(supplyItemLG); w.addItem(supplyItem2LG); w.show(); supplyItemLG.fetchData(new AdvancedCriteria("unitCost", OperatorId.EQUALS, 0.41F)); } private class SupplyItemListGrid extends ListGrid { public SupplyItemListGrid() { super(DataSource.get("supplyItem")); setAutoFetchData(false); setCanEdit(false); setCanGroupBy(false); setCanSort(false); setShowFilterEditor(true); setAllowFilterOperators(true); ListGridField itemID = new ListGridField("itemID"); itemID.setCanHide(false); itemID.setHidden(true); ListGridField itemName = new ListGridField("itemName"); ListGridField sku = new ListGridField("SKU"); ListGridField description = new ListGridField("description"); ListGridField category = new ListGridField("category"); ListGridField units = new ListGridField("units"); ListGridField unitCost = new ListGridField("unitCost"); ListGridField inStock = new ListGridField("inStock"); ListGridField nextShipment = new ListGridField("nextShipment"); setInitialSort(new SortSpecifier("itemName", SortDirection.ASCENDING)); setFields(itemID, itemName, sku, description, category, units, unitCost, inStock, nextShipment); } } }
Blama