ICEfaces
  1. ICEfaces
  2. ICE-9592

ace:dataTable > FilterOptions attribute doesn't function when using a String

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.3.0.GA_P01, 4.0.BETA
    • Fix Version/s: EE-3.3.0.GA_P02, 4.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      ICEfaces3 trunk revision# 37857
      EE-3.3.0.GA Maintenance Branch, Icefaces 4 trunk.
      Tomcat7
    • Assignee Priority:
      P1

      Description

      The ace:column filterOptions attribute doesn't work when using anything but a numerical value. If Strings are used to populate the options and you select an item from the list the option immediately reverts back to the first selection.

      To reproduce:
      1) Deploy test app located at: http://server.ice:8888/svn/repo/qa/trunk/Regression-Icefaces2/Sparkle/Nightly/dataTable
      2) Navigate to 'Filter' test.
      3) On the Album column try changing the filter using the drop down.

        Activity

        Hide
        Carmen Cristurean added a comment -

        Issue still reproducible with IF4 trunk rev# 39869/ EE-3.3.0-maintenance branch rev# 39821.

        Show
        Carmen Cristurean added a comment - Issue still reproducible with IF4 trunk rev# 39869/ EE-3.3.0-maintenance branch rev# 39821.
        Hide
        Arturo Zambrano added a comment - - edited

        After some extensive investigation, it was found that the root of the problem is in the Mojarra version used by the 3.3 EE maintenance branch.

        First of all, the problem has nothing to do with the FilterOptions attribute. Second, using strings for this attribute is invalid, as the TLD documentation for this attribute states that it "Defines a collection of SelectItem objects for use as filter choices." This is already corrected in the test app, but specifying a filter still doesn't work.

        Moreover, this problem doesn't occur in the 4.0 trunk, and it doesn't occur in the 3.3 EE branch when using MyFaces.

        After investigating the various methods in our code that handle filtering in the 3.3 EE maintenance branch (which happen to be identical to those of the 4.0 trunk), it was found that when specifying a filter, the filter value is never set properly in the column component nor in the FilterState object. In the end, the cause of this behaviour is that the DataTable.getColumns() method is returning twice the number of column components in the table. So, if a table has 8 columns, this method will return a list of 16 Column objects. So, the state of the different columns is being lost or doesn't match the right column. These 16 column objects have different hash codes and different object signatures, so it's not possible to implement a quick fix that simply checks for repeated objects.

        The root cause of this behaviour doesn't seem to be in our code; it starts when calling datatable.getChildren() (which we do not override in the DataTable class nor in the generator). The first time it's called, it returns twice the number of columns in the table. Subsequent invocations of this method return the actual number of columns in the table, but the state of the table and columns, in regards to filtering, is already corrupted and the filtering functionality doesn't work. As stated above, this seems to be a problem with the Mojarra version used in the 3.3 EE maintenance branch, since this problem doesn't happen in the 4.0 trunk. Moreover, the code that handles filtering is identical in the 3.3 EE maintenance branch and the 4.0 trunk. The problem doesn't happen either in the 3.3 EE maintenance branch when using MyFaces.

        Show
        Arturo Zambrano added a comment - - edited After some extensive investigation, it was found that the root of the problem is in the Mojarra version used by the 3.3 EE maintenance branch. First of all, the problem has nothing to do with the FilterOptions attribute. Second, using strings for this attribute is invalid, as the TLD documentation for this attribute states that it "Defines a collection of SelectItem objects for use as filter choices." This is already corrected in the test app, but specifying a filter still doesn't work. Moreover, this problem doesn't occur in the 4.0 trunk, and it doesn't occur in the 3.3 EE branch when using MyFaces. After investigating the various methods in our code that handle filtering in the 3.3 EE maintenance branch (which happen to be identical to those of the 4.0 trunk), it was found that when specifying a filter, the filter value is never set properly in the column component nor in the FilterState object. In the end, the cause of this behaviour is that the DataTable.getColumns() method is returning twice the number of column components in the table. So, if a table has 8 columns, this method will return a list of 16 Column objects. So, the state of the different columns is being lost or doesn't match the right column. These 16 column objects have different hash codes and different object signatures, so it's not possible to implement a quick fix that simply checks for repeated objects. The root cause of this behaviour doesn't seem to be in our code; it starts when calling datatable.getChildren() (which we do not override in the DataTable class nor in the generator). The first time it's called, it returns twice the number of columns in the table. Subsequent invocations of this method return the actual number of columns in the table, but the state of the table and columns, in regards to filtering, is already corrupted and the filtering functionality doesn't work. As stated above, this seems to be a problem with the Mojarra version used in the 3.3 EE maintenance branch, since this problem doesn't happen in the 4.0 trunk. Moreover, the code that handles filtering is identical in the 3.3 EE maintenance branch and the 4.0 trunk. The problem doesn't happen either in the 3.3 EE maintenance branch when using MyFaces.
        Hide
        Ken Fyten added a comment -

        Assign to Mircea to further analyze Art's findings, re:

        he root cause of this behaviour doesn't seem to be in our code; it starts when calling datatable.getChildren() (which we do not override in the DataTable class nor in the generator). The first time it's called, it returns twice the number of columns in the table. Subsequent invocations of this method return the actual number of columns in the table, but the state of the table and columns, in regards to filtering, is already corrupted and the filtering functionality doesn't work. As stated above, this seems to be a problem with the Mojarra version used in the 3.3 EE maintenance branch, since this problem doesn't happen in the 4.0 trunk. Moreover, the code that handles filtering is identical in the 3.3 EE maintenance branch and the 4.0 trunk. The problem doesn't happen either in the 3.3 EE maintenance branch when using MyFaces.

        Show
        Ken Fyten added a comment - Assign to Mircea to further analyze Art's findings, re: he root cause of this behaviour doesn't seem to be in our code; it starts when calling datatable.getChildren() (which we do not override in the DataTable class nor in the generator). The first time it's called, it returns twice the number of columns in the table. Subsequent invocations of this method return the actual number of columns in the table, but the state of the table and columns, in regards to filtering, is already corrupted and the filtering functionality doesn't work. As stated above, this seems to be a problem with the Mojarra version used in the 3.3 EE maintenance branch, since this problem doesn't happen in the 4.0 trunk. Moreover, the code that handles filtering is identical in the 3.3 EE maintenance branch and the 4.0 trunk. The problem doesn't happen either in the 3.3 EE maintenance branch when using MyFaces.
        Hide
        Arturo Zambrano added a comment - - edited

        Some more details...

        It's important to clarify that when getChildren() returns twice the number of columns in the table is only during the first request. It's not just the first time the method is called; it's during the whole lifescyle. This doesn't occur the first time the page is rendered nor at the second and subsequent requests.

        I found out that the showcase filtering demo doesn't have this issue. It seems that the problem in the test app is because of the use of the 'binding' attribute in the table. If this attribute is removed, then everything works normally.

        Show
        Arturo Zambrano added a comment - - edited Some more details... It's important to clarify that when getChildren() returns twice the number of columns in the table is only during the first request. It's not just the first time the method is called; it's during the whole lifescyle. This doesn't occur the first time the page is rendered nor at the second and subsequent requests. I found out that the showcase filtering demo doesn't have this issue. It seems that the problem in the test app is because of the use of the 'binding' attribute in the table. If this attribute is removed, then everything works normally.
        Hide
        Mircea Toma added a comment - - edited

        Modified DataTable.getFilterMap method to not cache its calculated results, since the results can change during the lifetime of the component instance.
        When data table binding is used the component instance is not recreated during component tree building causing the table to run with old filtering state.

        Show
        Mircea Toma added a comment - - edited Modified DataTable.getFilterMap method to not cache its calculated results, since the results can change during the lifetime of the component instance. When data table binding is used the component instance is not recreated during component tree building causing the table to run with old filtering state.
        Hide
        Liana Munroe added a comment -

        Confirmed fixed Icefaces 4 trunk, Icefaces ee-3.3.0 maintenance branch r40839. Tomcat 7, all browsers.

        Show
        Liana Munroe added a comment - Confirmed fixed Icefaces 4 trunk, Icefaces ee-3.3.0 maintenance branch r40839. Tomcat 7, all browsers.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Cruz Miraback
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: