Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    12.0p: Bug with groupByMaxRecords larger than 1000, progressive loading and invalidateCache

    Hi Isomorphic,

    please see this BuiltInDS based testcase (v12.0p_2019-03-23, also happening with more recent builds, in both FF26 Dev Mode and GC75 Super Dev Mode).
    It happens the same way in my application.

    Because of the reasons in this thread we wanted to disable the count query.
    Now this works as expected for the 1st load with requesting 10,000 (!) rows. But the reload via invalidateCache results in fetches for 0..1000 (!), then 1001..1076, then 1077..1152 and so on. Once a request returns, immediately a new one is sent.
    It seems that the supplyItem.setGroupByMaxRecords(10000) call is not taken into account for the invalidateCache fetch.

    Change to DataSource-tag of supplyItem.ds.xml:
    Code:
    progressiveLoading="true"
    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.DataSource;
    import com.smartgwt.client.data.SortSpecifier;
    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("95%");
            w.setHeight("95%");
            w.setMembersMargin(0);
            w.setModalMaskOpacity(70);
            w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
            w.setTitle("TITLE" + w.getTitle());
            w.setShowMinimizeButton(false);
            w.setIsModal(true);
            w.setShowModalMask(true);
            w.centerInPage();
    
            final ListGrid supplyItem = new ListGrid();
            supplyItem.setHeight100();
            supplyItem.setAutoFetchData(true);
            supplyItem.setCanEdit(true);
            supplyItem.setDataSource(DataSource.get("supplyItem"));
            supplyItem.setCanGroupBy(true);
            supplyItem.setGroupByField("units");
            supplyItem.setGroupByMaxRecords(10000);
            supplyItem.setSortByGroupFirst(true);
    
            ListGridField itemID = new ListGridField("itemID");
            ListGridField itemName = new ListGridField("itemName");
            ListGridField sku = new ListGridField("SKU");
            ListGridField category = new ListGridField("category");
            ListGridField units = new ListGridField("units");
    
            supplyItem.setFields(itemID, itemName, sku, category, units);
            supplyItem.setSort(new SortSpecifier[] { new SortSpecifier(sku.getName(), SortDirection.ASCENDING) });
            w.addItem(supplyItem);
    
            final IButton btn = new IButton("Invalidate Cache", new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    supplyItem.invalidateCache();
                }
            });
            w.addItem(btn);
    
            w.show();
        }
    }
    Best regards
    Blama

    #2
    We've fixed this back to SGWT 5.1p/SC 10.1p. It will be in the nightly builds dated 2019-07-19.

    Comment

    Working...
    X