ICEfaces
  1. ICEfaces
  2. ICE-9237

ace:dataTable filter value always set to lower case / filter value not shown in dropdown

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 4.0.BETA, EE-3.3.0.GA_P02, 4.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      Win 7, JDK 1.7.0_12-b02
    • Assignee Priority:
      P2
    • Salesforce Case Reference:
    • Affects:
      Compatibility/Configuration
    • Workaround Exists:
      Yes
    • Workaround Description:
      Explicitly convert the values of the select items to lower case. This does not work for all use cases as you might have select item that have the same value that differ only in case.

      Description

      During the processing of a request initiated by changing the filter (selecting another option in a dropdown) of a column, the transmitted value is set to lower case in

      FilterState:53 ([...] saveState(filteredColumn, params.get(filteredId).toLowerCase()) [...])

      This affects showing the selected option after rendering the updated table, as due to comparison mismatch always the first option available is shown but not the selected one.

      While rendering the response DataTableHeadRenderer:375 does the comparison based on the select items (having their values in original case, while the transmitted value has been set to lower case).

      I am not sure what class is in charge to set the value to lower case, but from my point of view it could be left to the implementations of FilterConstraint as it enables for having additional filters such as

      * startsWithIgnoreCase
      * endsWithIgnoreCase
      * exactIgnoreCase

      or to avoid breaking existing behaviour something like startsWithConsiderCase.

        Activity

        Hide
        Mark Collette added a comment -

        There is another place where we do a toLowerCase() on the filter value:

        DataTableDecoder.java line 230:
        if (filteredColumn != null) filteredColumn.setFilterValue(params.get(filteredId).toLowerCase());

        Even when not using the selection list of filters, but just a typed in value, the toLowerCase() causes problems. There's a DOM update for the text field, interfering with entering a string of more than one character.

        Here are the filter names any their associated code. We can see that only "exact" does not put the value to lower case, but they all put the filter to lower case. So, "exact" seems to have a bug. Either way, it appears that we don't need to lower case the filter back in FilterState.java:53 nor in DataTableDecoder.java:230, since it can be done right in the filter comparison, while continuing to hold and render the filter value as originally entered by the user, removing the DOM update that interferes with long filter value entry.

        "startsWith" : value.toLowerCase().startsWith(filter.toLowerCase())
        "endsWith" : value.toLowerCase().endsWith(filter.toLowerCase())
        "contains" : value.toLowerCase().contains(filter.toLowerCase())
        "exact" : value.equalsIgnoreCase(filter.toLowerCase())

        Show
        Mark Collette added a comment - There is another place where we do a toLowerCase() on the filter value: DataTableDecoder.java line 230: if (filteredColumn != null) filteredColumn.setFilterValue(params.get(filteredId).toLowerCase()); Even when not using the selection list of filters, but just a typed in value, the toLowerCase() causes problems. There's a DOM update for the text field, interfering with entering a string of more than one character. Here are the filter names any their associated code. We can see that only "exact" does not put the value to lower case, but they all put the filter to lower case. So, "exact" seems to have a bug. Either way, it appears that we don't need to lower case the filter back in FilterState.java:53 nor in DataTableDecoder.java:230, since it can be done right in the filter comparison, while continuing to hold and render the filter value as originally entered by the user, removing the DOM update that interferes with long filter value entry. "startsWith" : value.toLowerCase().startsWith(filter.toLowerCase()) "endsWith" : value.toLowerCase().endsWith(filter.toLowerCase()) "contains" : value.toLowerCase().contains(filter.toLowerCase()) "exact" : value.equalsIgnoreCase(filter.toLowerCase())
        Hide
        Ken Fyten added a comment -

        I think we should just remove the ".toLowercase()" so that the original case is preserved and highlight the change in the release notes in case some applications are now expecting it to always be lowercase.

        Show
        Ken Fyten added a comment - I think we should just remove the ".toLowercase()" so that the original case is preserved and highlight the change in the release notes in case some applications are now expecting it to always be lowercase.
        Hide
        Arturo Zambrano added a comment -

        Committed fix to 4.0 trunk at revision 39879 and to 3.3 EE maintenance branch at revision 39880. Removed toLowerCase() from FilterState and DataTableDecoder.

        Show
        Arturo Zambrano added a comment - Committed fix to 4.0 trunk at revision 39879 and to 3.3 EE maintenance branch at revision 39880. Removed toLowerCase() from FilterState and DataTableDecoder.

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Florian Jung
          • Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: