Announcement

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

    FormItem#buildValueExpressions broken in latest build when ListGrid#allowFilterOperators = false

    Dear Isomorphic,

    we use smartgwt and there is one thing that worked for us in 12.0p-2018-04-07 but is broken since 12.0p-2019-03-07 until now.

    We have listgrids and we do set allowFilterOperators to false, to have the previous behaviour of quick filters and not the new fancy buttons (since we were facing other issues with them), but using the text filter operators stopped work.

    i.e. using ==value in quick filter ends with an error now
    see Click image for larger version

Name:	Screenshot 2020-01-02 at 13.42.12.png
Views:	126
Size:	147.1 KB
ID:	260749

    We believe that this is due to the change in smartclient/client/widgets/form/FormItem.js in buildValueExpressions function where this snippet was added

    Code:
        if (!validOps) {
                validOps = [];
                for (var j=0; j< opList.length; j++) {
                    var opSymbol = opIndex[opList[j]];
                    validOps.addList(opSymbol.getProperty("ID"));
                }
        }
    From the stacktrace above, it seems that it expects the filter operator to be a javascript object but the operators seems to be just some regular expressions and the getProperty("ID") fails with this error.
    Probably this part of code should be run only if allowFilterOperators = true or there might be a better way how to fix.

    We would be very grateful if you can review this issue.

    Thanks a lot,
    Tomas

    #2
    We see no problems in the 12.0 online sample

    Comparing your ListGrid code to that code, or sharing a test-case here, may help isolate the problem.

    Comment


      #3
      Thanks a lot for looking into this.

      Turns out, that this is due to the fact that we do allow only case sensitive operators for text field type on datasource level (Datasource#setTypeOperators(FieldType.TEXT, ...) . i.e. the only enabled equal is "equals" and the == is currently translated to "iEquals", which is not allowed here and then it fails.

      Our code did not change, so I'm a bit puzzled now. Trying to figure out what can I do.

      Thanks!

      Comment


        #4
        That's an important bit of information - operator-selection in that case should be automatic - we'll take another look with case-sensitivity enforced and get back to you.

        Comment


          #5
          We still don't see an issue here - if you hit the 12.0 online sample, replace the ListGrid definition there with this code below (which includes a call to dataSource.setTypeOperators(), no criteria and allowFilterOperators: false), and then filter the countryName field for "==Qatar", then everything seems to work. The grid shows one record, there are no errors, and you can see in the developer console that the fetch used the "equals" operator. We also tested this in SmartGWT, with the same successful result.

          Be sure you're working with the latest nightly-build of 12.0 from smartclient.com/builds - if you still see issues against the latest build, let us know - we'll need a standalone test-case we can run that shows the problem, in order to help further.

          Code:
          worldDS.setTypeOperators("text", [ "equals", "notEqual", "between", "betweenInclusive" ]);
          
          isc.ListGrid.create({
              ID: "countryList",
              width:525, height:300, alternateRecordStyles:true,
              dataSource: worldDS,
              fields:[
                  {name:"countryCode", width:60},
                  {name:"countryName"},
                  {name:"capital"},
                  {name:"continent"},
                  {name:"area"},
                  {name:"population"}
              ],
              autoFetchData: true,
              showFilterEditor: true,
              allowFilterExpressions: true,
              allowFilterOperators: false
          })
          Last edited by Isomorphic; 18 Jan 2020, 21:56.

          Comment


            #6
            Thanks a lot Isomorphic!

            You're brilliant, it must be some our customization then.

            Thank you,
            T

            Comment


              #7
              It's possible for criteria to be applied silently, when grid.implicitCriteria (or other dev-supplied criteria) is applied, but isn't editable in the filterEditor (for example, because the operators aren't available to the grid, or the applicable field isn't visible).

              You might try calling getCriteria() on your grid to make sure it returns what you expect.
              Last edited by Isomorphic; 20 Jan 2020, 01:10.

              Comment

              Working...
              X