Announcement

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

    TextMatchStyle - must use same for all fields? (very strange results)

    When filtering the data, Is there a way to use different TextMatchStyle for the different fields?

    Here is the use case:

    - If I have a listGrid
    - When I create it, I set some criteria by executing ListGrid.fetchData(criteria). When I do this, the text match style will be exact, exactly what I want, and the wanted records are displayd.
    - Later, the user types in something into the filter row (for an other field), to narrow down the search. This causes an autoFetch to happen, with text match style set to subString.
    - Since the text match style is now substring, there are new matches, which the original filter excluded, because are not exact matches
    - So, after adding further conditions (by typing into the filter row), the user actually ends up with _more_ records, than before the filtering! (I have just seen this actually happening.)

    I guess this is not what anybody wants; adding further conditions should not relax the already configured ones.

    It's reasonable to assume substring for the user-filtered fields, but the code-configured criteria should be interpreted as configured.

    The solution would be to define different text match styles per field, instead of the current global one.

    Do you agree with the above?
    Last edited by csillag; 10 Mar 2010, 06:51.

    #2
    Use FormItem.operator via ListGridField.filterEditorProperties to specify the operator to be used for each field. Criteria applied to the grid do not in general imply operators to be used per field.

    Note there's no wrapper for filterEditorProperties yet so you need to specify it via setAttribute() with a JavaScriptObject containing one property/value pair, {operator:operatorId}.

    Comment


      #3
      OK, this works.

      Comment


        #4
        well, almost

        Thes is somewhat redundant with http://forums.smartclient.com/showthread.php?t=10345, but for the record, I post it here, too:

        OK, this _seems_ to work, but then leads to incorrect (?) criteria being generated by the ListGrid.

        I have set EXACT criteria for one set of (hidden) fields, and set the operators to iContains for the other set of fields.

        Then, when the user is searching, the ListGrid is sending criteria like this:

        Code:
            criteria:{
                DATA_SAVER_GROUP_ID:[
                    "_szolorg_admin_",
                    "_szolorg_dev_wizards_"
                ],
                _constructor:"AdvancedCriteria",
                operator:"and",
                criteria:[
                    {
                        fieldName:"DATA_NAME",
                        operator:"iContains",
                        value:"vál"
                    }
                ]
            },
        , which is in turn not parsed correctly by the SQL backend.
        (In the generated SQL query, the first criteria is omitted totally.)

        * * *

        Anyway, setting the operators for the filter fields _did_ work, only combining this with code/set criteria did not. (Which is a pity, because that's what I need.)

        Comment


          #5
          See that other thread - that criteria is invalid and looks like an incorrect attempt to merge simple Criteria and AdvancedCriteria.

          Comment


            #6
            take a look at this thread to
            http://forums.smartclient.com/showthread.php?t=12194
            Last edited by tpctech; 8 Jul 2010, 11:14.

            Comment

            Working...
            X