Announcement

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

    CellFormatter and filter

    If I have a cellFormatter that changes the value in some way, for example: "abc@def.com" -> "abc" (formatted, I cut everything after @), or "xyz" -> "<span style='color:red'>xyz</span>" (formatted, added style), then I am not able to filter to "ends with".
    Shouldn't the filter work with the shown values? I.e. with the formatted values?
    If you appy the filter to the unformatted values this would be confusing for the user. If this is not possible, is there any workaround?

    #2
    Hi edulid,

    I don't know about if the default behavior is correct, but I assume so, as you are only changing the formatting with your CellFormatter, not the value.
    If so, perhaps FormItem.setCriterionGetter() on your filterEditor can help you. You could modify the criteria you get for the filterValue entered by the user.

    Best regards
    Blama

    Comment


      #3
      There's no way the filter could work with formatted values. The first major problem is that the server doesn't even have those values, and the second is that the formatting often includes HTML, not visible to the user, which would nevertheless match filters.

      If you are finding yourself trimming information from values, consider delivering the value already in the format you want to show the user, and moving any additional information to another field (possibly using the listGridField.displayField property as part of this).

      Comment

      Working...
      X