Announcement

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

    12.0p ListGrid filterRow operator symbol sometimes displayed, sometimes not

    Hi Isomorphic,

    please see this modified testcase (v12.0p_2020-03-24) of a behavior we also observe in our application:
    Code:
    isc.ListGrid.create({
        ID:"dsListGrid",
        width: "100%",
        height: 500,
        autoFetchData: true,
        dataSource: "supplyItem",
        // allowFilterExpressions: true,
        fields:[
            {name:"itemID", width:60},
            {name:"itemName", hidden:true, defaultOperator: "iContains", operator: "iContains"},
            {name:"SKU", hidden:true, defaultOperator: "equals", operator: "equals"},
            {name:"category", defaultOperator: "equals", operator: "equals"},
            {name:"units"}
        ]
    });
    
    isc.IButton.create({
        top: 510,
        ID:"filterButton",
        title:"Filter",
        click : function () {
            dsListGrid.setShowFilterEditor(!dsListGrid.showFilterEditor);
        }
    })
    Depending on the order of "Show filter" and "Unhide fields" the result is different:

    "Unhide fields" -> "Show filter" (OK):
    Click image for larger version

Name:	Unhide-Filter.gif
Views:	201
Size:	292.1 KB
ID:	261515






    "Show filter" -> "Unhide fields" (Not OK):
    Here also the (default) filter symbol is removed on click on it ("Item", expected), while this does not happen if it is not the default operator ("SKU", expected???)


    Click image for larger version

Name:	Filter-Unhide.gif
Views:	154
Size:	434.1 KB
ID:	261516

    Best regards
    Blama

    #2
    To clarify, IMHO the icons should not be displayed at all in the 2nd case, also not for the SKU-field.

    I'm not sure if they should be displayed with allowFilterExpressions: true as well, when there is nothing entered.

    Comment


      #3
      You're right, there was a bug here. The rule is that we only show an icon if the current operator is different from the item's default operator, or alwaysShowOperatorIcon is true.

      Fixed for builds dated March 26 and later.

      Comment


        #4
        Hi Isomorphic,

        the issue for field itemName is fixed using v12.0p_2020-03-26. But I assume there is another issue with field SKU, which is already visible in the first video in #1.
        The filter for that field is not set. Also the equals operator icon is not visible. This is most likely because the operator: "equals" is not honored. Easy to see if you reproduce the video from #1 with alwaysShowOperatorIcon: true.

        If you then enter e.g. "453" now, this results in this request, returning 10 rows:
        Code:
        {
            dataSource:"supplyItem", 
            operationType:"fetch", 
            componentId:"dsListGrid", 
        [B]    data:{
                SKU:"453"
            }, [/B]
            startRow:0, 
            endRow:75, 
        [B]textMatchStyle:"substring", [/B]
        ...
        I'd expect a fetch like this (resulting in zero rows):
        Code:
        {
            dataSource:"supplyItem", 
            operationType:"fetch", 
            componentId:"dsListGrid", 
        [B]    data:{
                operator:"and", 
                criteria:[
                    {
                        fieldName:"SKU", 
                        operator:"equals", 
                        value:"453"
                    }
                ]
            }, [/B]
            startRow:0, 
            endRow:75, 
            textMatchStyle:"substring",
        Best regards
        Blama

        Comment


          #5
          The problem here is that filterEditor formItems are not picking up "defaultOperator" from the field - we'll look into that.

          In the meantime, you can see what should be happening by setting defaultOperator on the formItem, via filterEditorProperties, instead of the field proper:

          Code:
                  {name:"SKU", hidden:true, filterEditorProperties: { defaultOperator: "equals" }, operator: "equals"},
          Note that, unless alwaysShowOperatorIcon is true, expected behavior is that an operatorIcon will not be displayed if item.operator == item.defaultOperator - if you right click the filterEditor item, you should see that your selected defaultOperator is flagged as being the default, and your criteria should appear as you expect.

          This should apply irrespective of the order you do things in.

          Comment


            #6
            You should find this fixed in builds dated March 27 and later.

            Note that defaultOperator isn't actually documented on ListGridField - however, it *is* documented on DataSourceField and FormItem, so ListGrid will now apply it if it's there.
            Last edited by Isomorphic; 26 Mar 2020, 06:19.

            Comment


              #7
              Hi Isomorphic,

              now using v12.0p_2020-03-28, the display issue is fixed in both cases, but filtering only in one case. In the video, the request is still without operator (= textMatchStyle:"substring"):

              Click image for larger version

Name:	operator_not_used.gif
Views:	141
Size:	590.8 KB
ID:	261610


              Best regards
              Blama

              Comment


                #8
                Right, that's just because ListGridField.operator doesn't do what you're expecting it to do - please see the doc for that setting - you should find filterOperator works as expected.
                Last edited by Isomorphic; 28 Mar 2020, 07:03.

                Comment


                  #9
                  Hi Isomorphic,

                  thanks. So setting operator doesn't do anything here, right?
                  If I enable the commented out allowFilterExpressions: true, I can see that defaultOperator (which is also in the sample) is working in both cases (1st filterRow, 2nd unhide columns or 1st unhide columns, 2nd filterRow).

                  There is still the difference between ways one and two w.r.t. the equals operator, see here for the other way (1st filterRow, 2nd unhide columns) compared to #7:
                  If I understand you right in #8, behavior in #7 is correct and this here is wrong (but then I don't get why equals is selected in the context menu, in both cases).

                  To me, this here seems correct and the one in #7 seems wrong.

                  Click image for larger version

Name:	operator_used.gif
Views:	143
Size:	396.9 KB
ID:	261613

                  Bets regards
                  Blama

                  Comment


                    #10
                    ListGridField.operator just shouldn't be set by developers in this way - from the docs: "Note that this property is not listed as "initializable" and is not intended as a means of applying a default operator to the field. Rather, it simply reflects any non-default operator already applied to menu item "Filter Using"

                    So, you should always use filterOperator. When you do that, the filtering behavior in #9 is correct. We're not clear what you mean about us implying that #7 was correct, but using filterOperator"equals" should cause filtering to work according to the "equals" operator, returning no rows.
                    Last edited by Isomorphic; 28 Mar 2020, 07:42.

                    Comment


                      #11
                      Hi Isomorphic,

                      I also do see that everything is working as expected when I use just filterOperator instead of defaultOperator:
                      Code:
                          fields:[
                              {name:"itemID", width:60},
                              {name:"itemName", hidden:true, filterOperator: "iContains"},
                              {name:"SKU", hidden:true, filterOperator: "equals"},
                              {name:"category", filterOperator: "equals"},
                              {name:"units"}
                          ]



                      Please note though that the way you suggest in #5 (filterEditorProperties) has the same problem (using iContains instead of equals for SKU) if you do 1st unhide columns, 2nd filterRow:
                      Code:
                          fields:[
                              {name:"itemID", width:60},
                              {name:"itemName", hidden:true, filterEditorProperties: { defaultOperator: "iContains" }, operator: "iContains" },
                              {name:"SKU", hidden:true, filterEditorProperties: { defaultOperator: "equals" }, operator: "equals" },
                              {name:"category", filterEditorProperties: { defaultOperator: "equals" }, operator: "equals" },
                              {name:"units"}
                          ]

                      Thank you & Best regards
                      Blama

                      Comment


                        #12
                        Hi Isomorphic,

                        I didn't see you #10 before my #11, crosspost.

                        Thank you, I agree, it's working with filterOperator just fine.
                        Only thing left is the last part of #11 (your way from #5), here without operator (as you say in #10):

                        Code:
                            fields:[
                                {name:"itemID", width:60},
                                {name:"itemName", hidden:true, filterEditorProperties: { defaultOperator: "iContains" }},
                                {name:"SKU", hidden:true, filterEditorProperties: { defaultOperator: "equals" }},
                                {name:"category", filterEditorProperties: { defaultOperator: "equals" }},
                                {name:"units"}
                            ]
                        Best regards
                        Blama
                        Last edited by Blama; 28 Mar 2020, 09:34.

                        Comment


                          #13
                          We'll take another look at this last case later today and get back to you.

                          Comment


                            #14
                            Hi Isomorphic,

                            did you have the time to look at this one?

                            Thank you & Best regards
                            Blama

                            Comment


                              #15
                              Not as yet - we'll get to it in the next day or so and let you know.

                              Comment

                              Working...
                              X