Announcement

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

    setImplicitCriteria() update?

    Hello,

    I am trying to change the implicit criteria for a ListGrid in order to focus on different subsets of a data source with a code like this:
    setImplicitCriteria(criteria);
    fetchData(criteria);
    and at the same time to be able to use the row filter for further compound filtering with the initial criteria...

    However only the first call to setImplicitCriteria is taken into consideration and any subsequent call of the above code with another criteria just displays an empty ListGrid. But setting back the first criteria again displays correctly.

    Is this a bug or this is how setImplicitCriteria() should behave? Meaning once it gets set you can never update it?

    Using SmartClient Version: v13.0p_2022-01-09/LGPL Development Only (built 2022-01-09)

    Thank you

    #2
    hi slick07

    No, this is not how it should behave - implicitCriteria can be updated at any time, and we have a bunch of autotests showing this working correctly.

    setImplicitCriteria() replaces the existing implicitCriteria on the component and, if it's different, automatically invalidates the cache.

    This means that no subsequent fetch should be necessary. But if you *do* issue a fetch, don't pass the same criteria as you pass to setImplicitCriteria(), as your code above seems to do.

    Calling setImplicitCriteria() replaces *only* the implicitCriteria - it does not affect any other criteria - so there is no need to reapply other criteria at the same time. But again, if you do, you shouldn't be applying the same crit as both implicit criteria, which is hidden from the user, and regular, explicit criteria that the user can edit.

    If these details don't help to solve your problem, please post a standalone test-case that shows it and we can take a look.
    Last edited by Isomorphic; 12 Feb 2022, 23:07.

    Comment


      #3
      Hi Isomorphic

      I was also calling fetchData(criteria) because the ListGrid on which I tested had autoFetch on false and because the documentation of setImplicitCriteria() does not mention that it invalidates cache. So I assumed that I have to call fetch...

      It seems to work correctly for ListGrids with autoFetch on true. For list grids with autoFetch on false:
      - it works correctly if I just call fetchData()
      - but it displays an empty ListGrid if I call fetchData(criteria) where criteria is the same as the one used for setImplicitCriteria() (I do not understand why this happens but I take your words for it and just use the above fetchData() without any criteria)

      Anyway the problem is solved. Thank you very much for your hint regarding cache invalidation!

      Comment


        #4
        We'll take a look at the doc and improve it where needed.

        It isn't clear what installing the same criteria as both hidden, immutable criteria, and visible, user-editable criteria would be expected to achieve - but it isn't supported behavior anyway. However, we've made a note to take a look at why it behaves that way when you try it.

        Comment


          #5
          Hi Isomorphic,

          After starting to use the setImplicitCriteria(Criteria) on TreeGrids we noticed that after a DSOperationType.UPDATE on a TreeNode that is outside of the implicit criteria (it is not visible) it appears within the TreeGrid although it still does not satisfy the implicit criteria and should not be visible.

          Using filterData(Criteria) instead of setImplicitCriteria(Criteria) does not present the above misbehaviour.

          Comment


            #6
            Hi Isomorphic , Could you please give us a helping hand with the above misbehavior of setImplicitCriteria(Criteria) on TreeGrids? I can try to provide a test case if needed. Thank you!

            Comment


              #7
              Apologies for the delay on this - it looks like some parts of implicitCriteria support are missing for ResultTree/TreeGrid.

              We'll look into it this week and let you know when we've added the incomplete bits.

              Comment


                #8
                We've fixed cache-sync as it relates to implicitCriteria in ResultTrees, and this addresses your issue.

                You can try out the fix in builds of your branch dated October 21 or later.

                Comment


                  #9
                  Unfortunately now the filtering mechanism seems to got broken... The same code:
                  - with the old version of SmartGWT it updates the interface accordingly with the applied implicit filters (but has the cache problems)
                  - with the new SmartGWT version (SmartClient Version: v13.0p_2022-10-25/LGPL Development Only (built 2022-10-25)) it does not apply the implicit filters at all and it just displays all data as if no filter was applied. Furthermore if we apply an additional filter using treeGrid.filterData(filter); the TreeGrid becomes empty and remains that way no matter what we do and a bunch of "Attempted to use unknown operator undefined" warnings appear in the console.

                  Comment


                    #10
                    This seems an almost impossible result, given the changes we made.

                    Please show standalone code we can run to see the issue.

                    Comment


                      #11
                      In fact, we've reproduced this and we see what the problem is - we're making a fix and will update here when it hits builds.

                      Comment


                        #12
                        We've applied a fix for this regression in behavior - while cache-sync had been fixed, a logic flaw meant that setImplicitCriteria() itself was not initializing filtering for ResultTree.

                        Please retest with a build dated October 28 or later

                        Comment


                          #13
                          I confirm that the problem was fixed. Thank you!

                          Comment


                            #14
                            Hi Isomorphic,

                            After further tests it seems that for TreeGrids with setKeepParentsOnFilter(true); the implicit filter mechanism does not work correctly. Only the first applied implicit filter works correctly and any other subsequent implicit filters results in an empty TreeGrid.

                            I have attached a test case to reproduce the problem. Just change the filter using the SelectItem.

                            Using SmartClient Version: v13.0p_2022-12-31/LGPL Development Only (built 2022-12-31)

                            Thank you!
                            Attached Files

                            Comment


                              #15
                              Thanks for the report - we're taking a look and will update here shortly.

                              Comment

                              Working...
                              X