Announcement

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

    Filter with contains

    Hi Isomorphic,

    SmartGWT13.

    An unusual behavior is noticed when attempting to apply the "Contains" filter on a float field with a value of "0". In this case, all the data present in the ListGrid is retrieved, which is strange since testing with other values shows the expected functionality. However, when adding the filter in the following way "~0", the filtering process is carried out correctly. This occurs both in my application and in the SmartGWT 13 demo.

    I have attached a video demonstrating both behaviors.



    #2
    Hi Camilo, the "contains" operator is not supported for fields of "float" type. If you could take a look at the server logs here (which you can do if you try this out with the local SDK) you would see that the invalid criterion is just being ignored by the server, which is why all records match.

    There are a few different things you can do here if you want "contains" support for "float":

    1. if the field happens to be stored as a float, but it's really it's more like an ID and all UI behavior basically works with it as a String, you can re-declared it a type:"text" and either update the DB or use something like dataSourceField.customSelectExpression to transform to a text type

    2. if you actually require both numerically-based and textually-based filtering on the same field, you could use the SQL Templating system (e.g. customCriteriaExpression) to handle this

    3. if you have a bunch of fields that require both types of filtering to "just work", this could be added as a feature via our Feature Sponsorship program. The reason it's not already a feature is because it's rarely requested, and trying to make it work on all data providers could be a slog. But it could be added as a narrower feature supported just for the data providers where you need it

    Let us know how you'd like to approach this. Thanks!

    Comment

    Working...
    X