Announcement

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

    12.0p, 13.0p setting implicitCriteria with implicitCriteria and setImplicitCriteria broken

    Hi Isomorphic,

    using 12.0p and 13.0p (I'm using 12.0p) I noticed different issues with implicitCriteria / setImplicitCriteria().

    I'm coming from SmartGWT, where there is a setImplicitCriteria() in 12.0p and 13.0p.
    In SmartClient there seems setImplicitCriteria() to be present only in 13.0p DataBoundComponent. 12.0p ListGrid only knows attribute implicitCriteria, but this is IRW, so settable.
    At least this is what is doc'd, the method seems to be existing anyway in 12.0p. I'm using the method also in 12.0p, if that's not allowed, I can adjust the testcase here.

    Please this modified testcase (always using setImplicitCriteria()) which has problems in both versions (v12.0p_2022-03-31, v13.0p_2022-04-02), but less problems in 13.0p.

    Code:
    isc.DynamicForm.create(
    {
        ID: "filterForm",
        width: 300,
        operator: "and",
        saveOnEnter: true,
        dataSource: worldDS,
        submit: function()
        {
            filterGrid.filterData(filterForm.getValuesAsCriteria());
        },
        fields: [
        {
            name: "countryName",
            title: "Country Name contains",
            wrapTitle: false,
            type: "text"
        },
        {
            type: "blurb",
            defaultValue: "<b>AND</b>"
        },
        {
            name: "population",
            title: "Population smaller than",
            wrapTitle: false,
            type: "number",
            operator: "lessThan"
        },
        {
            type: "blurb",
            defaultValue: "<b>AND</b>"
        },
        {
            name: "independence",
            title: "Nationhood later than",
            wrapTitle: false,
            type: "date",
            useTextField: true,
            operator: "greaterThan"
        }]
    });
    isc.ListGrid.create(
    {
        ID: "filterGrid",
        width: 850,
        height: 300,
        alternateRecordStyles: true,
        dataSource: worldDS,
        autoFetchData: true,
        useAllDataSourceFields: true,
        fields: [
        {
            name: "countryCode",
            width: 60
        },
        {
            name: "government",
            title: "Government",
            width: 95
        },
        {
            name: "independence",
            title: "Nationhood",
            width: 100
        },
        {
            name: "population",
            title: "Population",
            width: 100
        },
        {
            name: "gdp",
            title: "GDP ($M)",
            width: 85
        }]
    });
    isc.IButton.create(
    {
        ID: "europeAsiaBtn",
        title: "Europe/Asia",
        click: function()
        {
            filterGrid.setImplicitCriteria(
            {
                _constructor: "AdvancedCriteria",
                operator: "and",
                criteria: [
                {
                    fieldName: "continent",
                    operator: "inSet",
                    value: ["Europe", "Asia"]
                }]
            });
        }
    });
    isc.IButton.create(
    {
        ID: "europeAsiaAusBtn",
        title: "Europe/Asia/Aus",
        click: function()
        {
            filterGrid.setImplicitCriteria(
            {
                _constructor: "AdvancedCriteria",
                operator: "and",
                criteria: [
                {
                    fieldName: "continent",
                    operator: "inSet",
                    value: ["Europe", "Asia", "Australia/Oceania"]
                }]
            });
        }
    });
    isc.IButton.create(
    {
        ID: "allCtnBtn",
        title: "All continents",
        click: function()
        {
            filterGrid.setImplicitCriteria(null);
        }
    });
    isc.IButton.create(
    {
        ID: "filterBtn",
        title: "Filter",
        click: function()
        {
            filterForm.submit();
        }
    });
    isc.IButton.create(
    {
        ID: "refreshBtn",
        title: "refreshData()",
        click: function()
        {
            filterGrid.refreshData();
        }
    });
    isc.IButton.create(
    {
        ID: "fetchBtn",
        title: "fetchData()",
        click: function()
        {
            filterGrid.fetchData();
        }
    });
    isc.IButton.create(
    {
        ID: "invalidateBtn",
        title: "invalidateCache()",
        click: function()
        {
            filterGrid.invalidateCache();
        }
    });
    isc.HStack.create(
    {
        ID: "criteriaBtnStack",
        membersMargin: 30,
        height: 1,
        members: [
            isc.Label.create(
            {
                contents: "Implicit Criteria:",
                height: 1
            }), europeAsiaBtn, europeAsiaAusBtn, allCtnBtn
        ]
    });
    isc.HStack.create(
    {
        ID: "reloadBtnStack",
        height: 1,
        membersMargin: 30,
        members: [
            isc.Label.create(
            {
                contents: "Different reloads:",
                height: 1
            }),
            refreshBtn, fetchBtn, invalidateBtn
        ]
    });
    isc.VStack.create(
    {
        membersMargin: 30,
        members: [
            filterForm, filterBtn, criteriaBtnStack, reloadBtnStack, filterGrid
        ]
    });
    12.0p:
    • Click the different Implicit Criteria buttons to notice that only looser criteria result in a new fetch. More strict criteria will only be applied with the next refreshCache() / invalidateCache(). fetchData() does not have an effect.
    13.0p:
    • "All continents" button after other criteria buttons has no effect, only applied with the next refreshData(). invalidateCache() / fetchData() then result in a fetch with the old criteria.
    As written this is an issue in both versions, but the 12.0p issue is more important for me.

    Best regards
    Blama

    #2
    Hi Isomorphic,

    using 12.0p it does not matter for the result if one uses the non-doc'd setImplicitCriteria(...) or filterGrid.setProperty("implicitCriteria", ...).

    Best regards
    Blama

    Comment


      #3
      Hi Isomorphic,

      a quick test with the testcase from #1 and v12.1p_2022-04-01 (which also DataBoundComponent.setImplicitCriteria()) seems to work as expected, meaning there would only be issues with 12.0p and 13.0p, which seems a bit strange.

      Best regards
      Blama

      Comment


        #4
        Hi Isomorphic,

        my use case is a ListGrid with additional filters above the ListGrid in a DynamicForm with a itemChanged handler, that then applies these criteria as implicitCriteria.
        I recreated this here in v12.0p_2022-03-31 and it shows the same issue as in my application.
        Please use the "Category filter" and "Unit filter" multiple: true-SelectItems, that don't filter on the 1st selection or when you reduce the amount of clicked boxes.

        Code:
        isc.defineClass("CustomListGrid", "ListGrid").addProperties(
        {
            init: function()
            {
                this.Super("init", arguments);
                var toolStrip = isc.ToolStrip.create(
                {
                    membersMargin: 5,
                    members: [
                        isc.Label.create(
                        {
                            wrap: false,
                            padding: 5,
                            contents: "0 to 0 of 0",
                            getRowRangeText: function(arrayVisibleRows, totalRows, lengthIsKnown)
                            {
                                if (!lengthIsKnown) return "Loading...";
                                else if (arrayVisibleRows[0] != -1) return (arrayVisibleRows[0] + 1) + " to " + (arrayVisibleRows[1] + 1) + " of " + totalRows;
                                else return "0 to 0 of 0";
                            }
                        }),
                        isc.LayoutSpacer.create(
                        {
                            width: "*"
                        }), "separator",
                        isc.ImgButton.create(
                        {
                            grid: this,
                            src: "[SKIN]/actions/cancel.png",
                            showRollOver: false,
                            prompt: "Clear Filter",
                            width: 16,
                            height: 16,
                            showDown: false,
                            click: function()
                            {
                                this.grid.setFilterEditorCriteria(
                                {});
                                this.grid.filterByEditor();
                            }
                        }),
                        isc.ImgButton.create(
                        {
                            grid: this,
                            src: "[SKIN]/actions/refresh_Disabled.png",
                            showRollOver: false,
                            prompt: "refreshData()",
                            width: 16,
                            height: 16,
                            showDown: false,
                            click: function()
                            {
                                this.grid.refreshData();
                            }
                        }), isc.ImgButton.create(
                        {
                            grid: this,
                            src: "[SKIN]/actions/refresh_Disabled.png",
                            showRollOver: false,
                            prompt: "fetchData()",
                            width: 16,
                            height: 16,
                            showDown: false,
                            click: function()
                            {
                                this.grid.fetchData();
                            }
                        }), isc.ImgButton.create(
                        {
                            grid: this,
                            src: "[SKIN]/actions/refresh_Disabled.png",
                            showRollOver: false,
                            prompt: "invalidateCache()",
                            width: 16,
                            height: 16,
                            showDown: false,
                            click: function()
                            {
                                this.grid.invalidateCache();
                            }
                        }), , "separator",
                        isc.DynamicForm.create(
                        {
                            grid: this,
                            numCols: 4,
                            fields: [
                            {
                                name: "category",
                                showTitle: true,
                                title: "Category filter",
                                type: "select",
                                //operator: "inSet",
                                multiple: true,
                                width: 150,
                                valueMap:
                                {
                                    "Blu-Tack": "Blu-Tack",
                                    "Roll-on Glue": "Roll-on Glue",
                                    "Super Glue": "Super Glue",
                                    "Pastes and Gum": "Pastes and Gum",
                                    "U-Tac": "U-Tac"
                                }
                            },
                            {
                                name: "units",
                                showTitle: true,
                                title: "Unit filter",
                                type: "select",
                                //operator: "inSet",
                                multiple: true,
                                width: 150,
                                valueMap:
                                {
                                    "Roll": "Roll",
                                    "Ea": "Ea",
                                    "Pkt": "Pkt",
                                    "Set": "Set",
                                    "Tube": "Tube",
                                    "Pad": "Pad",
                                    "Ream": "Ream",
                                    "Tin": "Tin",
                                    "Bag": "Bag",
                                    "Ctn": "Ctn",
                                    "Box": "Box"
                                }
                            }],
                            itemChanged: function(item, newValue)
                            {
                                if (item.form.getValuesAsAdvancedCriteria())
                                {
                                    item.form.grid.setProperty("implicitCriteria", item.form.getValuesAsAdvancedCriteria());
                                }
                                else
                                {
                                    item.form.grid.setProperty("implicitCriteria", null);
                                }
                            }
                        })
                    ]
                });
                this.setProperty("gridComponents", ["filterEditor", "header", "body", "summaryRow", toolStrip]);
            },
            initWidget: function()
            {
                this.Super("initWidget", arguments);
                this.observe(this, "dataChanged", function()
                {
                    this.updateRowRangeDisplay();
                });
                this.observe(this, "scrolled", function()
                {
                    this.updateRowRangeDisplay();
                });
            },
            updateRowRangeDisplay: function()
            {
                var label = this.gridComponents[4].getMember(0);
                label.setContents(label.getRowRangeText(this.getVisibleRows(), this.getTotalRows(), this.data.lengthIsKnown()));
            }
        });
        isc.CustomListGrid.create(
        {
            ID: "categoryList",
            showFilterEditor: true,
            width: "100%",
            height: 500,
            dataSource: supplyItem,
            autoFetchData: true
        });
        Best regards
        Blama

        Comment


          #5
          hi Blama - thanks for the test-case, we're looking into these reports and will let you know when we have them fixed.

          Comment


            #6
            Hi Isomorphic,

            just to let you know: So far I reported the problem for 12.0p and 13.0p only and not in 12.1p. Right now I'm using v12.1p_2022-04-12 to develop in order to finish the feature. Yesterday I noticed that the problem also affects 12.1p. Perhaps not in the test case above, but in my application.
            So I assume whatever changes you need to do to 12.0p and 13.0p will also be needed in 12.1p.

            Best regards
            Blama

            Comment


              #7
              Hi Blama
              Thanks for the follow-up and apologies for the delay in addressing this issue - we're shoring up the implicitCriteria mechanism, and adding some new docs and logs to make debugging easier. These modifications will arrive shortly and we'll make sure the necessary changes make it into all affected branches.

              Comment


                #8
                hi Blama ,

                On your second test-case from post #4 - we see two specific issues in 12.0:

                1) in both pickers, the first item-select does not cause a filter when it should
                2) with, eg, 4 items selected in either picker, if you unselect them one at a time, the last two will not cause a filter when they should

                If those are the issues you're seeing, we've fixed both of them in 12.0, which version had only a rudimentary and undoc'd implementation of setImplicitCriteria(). In 12.1, the test-case from #4 seems to work without issue. In 13.0+, there we see just one issue, where unselecting the final checked item would not cause a filter, because there was a crash happening when setImplicitCriteria() was passed null. This has also been fixed in 13.0+.

                Those changes will be in builds dated April 14 and later. We'll update on the original test-case from #1 shortly.
                Last edited by Isomorphic; 13 Apr 2022, 09:10.

                Comment


                  #9
                  hi Blama

                  We've ported a better DataBoundComponent.setImplicitCriteria() implementation back to 12.0, and exposed it in the docs in that branch. This implementation corrects automatic cache-invalidation in all cases, in our testing. The separate fix, which is 13.0+, addresses a crash specifically for setImplicitCriteria(null), which your first test-case uses.

                  With these changes, we are seeing all the buttons in your first test and all selection-combinations in your second test behave as expected, in all branches.

                  Please retest with a build dated April 14 or later and let us know if you still see any issues in your app.

                  Comment


                    #10
                    Hi Isomorphic,

                    thanks. So far I'm testing the testcase from #1 with v12.0p_2022-04-14, v12.1p_2022-04-13 (!), v13.0p_2022-04-14.
                    Did I understand you correctly that there was no change to 12.1p because of this?

                    I can see the new method DataBoundComponent.setImplicitCriteria() in 12.0p and also the the 13.0p-only issue with the setImplicitCriteria(null) is working as expected.

                    Regarding the 1st issue in #1:
                    This seems to be fixed to be as well, but I can see one unexpected behavior I can't explain:
                    • Start sample
                    • Click "Europe/Asia" or "Europe/Asia/Aus" -> an expected fetch is issued
                    • Click fetchData() -> an unexpected fetch is issued
                    This happens in all three branches and only on start, not if you do the same clicks again directly after again.

                    I'll test the testcase from #4 next and also try to reproduce my issue with 12.1p.

                    Best regards
                    Blama

                    Comment


                      #11
                      Hi Isomorphic,

                      I tried the test case from #4 in a slightly modified form with v12.0p_2022-04-14, v12.1p_2022-04-13 (!), v13.0p_2022-04-14, making use of DataBoundComponent.setImplicitCriteria(), now present in all three branches:
                      Code:
                      itemChanged: function(item, newValue)
                                          {
                                              if (item.form.getValuesAsAdvancedCriteria())
                                              {
                                                  item.form.grid.setImplicitCriteria(item.form.getValuesAsAdvancedCriteria());
                                              }
                                              else
                                              {
                                                  item.form.grid.setImplicitCriteria(null);
                                              }
                                          }
                      Everything seems to work as expected here.

                      Thank you & Best regards
                      Blama

                      Comment


                        #12
                        1) Correct - we didn't see any issues when testing 12.1 - however, note that the 13.0+ code *is* different from 12.1-, so if you're seeing 12.1 issues, they may already be addressed in 13.0

                        2a) firstly, note that setImplicitCriteria() will always invalidate the cache if it changes the current implicitCriteria - we may need to revisit that, but always invalidating is the current documented behavior.

                        2b) secondly, the unexpected fetch from fetchData() is almost certainly the result of a different textMatchStyle being used in each case. We're aware of this generally with combined implicitCriteria and it will be addressed shortly.
                        Last edited by Isomorphic; 14 Apr 2022, 23:27.

                        Comment

                        Working...
                        X