ICEfaces
  1. ICEfaces
  2. ICE-1545

A paginated dataTable does not properly update its content upon changes of the rows attribute

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.3, 1.7.2
    • Fix Version/s: 1.8RC1, 1.8
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Tomcat 5.5
      Java 1.4.2
      Jboss 4.2.0

      Description

      When dynamically changing the rows attribute of the dataTable component (e.g. through a listbox to select the number of hits per page), the dataPaginator updates correctly, but the dataTable does not.
      Scenario:

      - the user paged to the end of a list of 199 items
      - the number of hits per page is changed from (say) 10 to 100
      - now, instead of displaying 99 items (the first 100 on the first page, 99 on the current page), the table only displays 9 items.

      Not a big deal, but certainly not correct, or at least counter-intuitive.
      1. SC5235.doc
        106 kB
        Tyler Johnson
      1. ICE-1545.jpg
        53 kB

        Activity

        Hide
        User Ansel1 added a comment -

        This actually becomes very annoying when the rows attribute is changed to a high enough value to display all the rows in the table, and the paginator's renderFacetsIfSinglePage is set to false. In this case, the paginator disappears completely, while the table is still only showing a subset of the total rows.

        Even if renderFacetsIfSinglePage is set to true, the paginator buttons won't do anything once the number of pages is 1. So the user has to set the rows back down to some number that causes total pages to be > 1, flip to page one with the paginator, then set to the rows back up again.

        Show
        User Ansel1 added a comment - This actually becomes very annoying when the rows attribute is changed to a high enough value to display all the rows in the table, and the paginator's renderFacetsIfSinglePage is set to false. In this case, the paginator disappears completely, while the table is still only showing a subset of the total rows. Even if renderFacetsIfSinglePage is set to true, the paginator buttons won't do anything once the number of pages is 1. So the user has to set the rows back down to some number that causes total pages to be > 1, flip to page one with the paginator, then set to the rows back up again.
        Hide
        Adnan Durrani added a comment -

        I have build the war using the attached source code with ICEfaces 1.7.1. and I found that the pagination was not working, so after adding the following setter into the TableBean, the application is working just fine. I have also attached a war file and a snapshot.

        public void setRows(int rows)

        { this.rows = rows; }

        I have also tested the app with 1.7.0 beta and didn't find any problem either.

        The app is compiled using JAVA 5

        Show
        Adnan Durrani added a comment - I have build the war using the attached source code with ICEfaces 1.7.1. and I found that the pagination was not working, so after adding the following setter into the TableBean, the application is working just fine. I have also attached a war file and a snapshot. public void setRows(int rows) { this.rows = rows; } I have also tested the app with 1.7.0 beta and didn't find any problem either. The app is compiled using JAVA 5
        Hide
        Tyler Johnson added a comment -

        Attached is a war file with 1.7.2 demonstrating the issue. I've also attached a word doc that describes the issue in greater detail with screenshots.

        Show
        Tyler Johnson added a comment - Attached is a war file with 1.7.2 demonstrating the issue. I've also attached a word doc that describes the issue in greater detail with screenshots.
        Hide
        Tyler Johnson added a comment -

        Sample application intended for deployment on Jboss 4.2.0.GA

        Show
        Tyler Johnson added a comment - Sample application intended for deployment on Jboss 4.2.0.GA
        Hide
        Adnan Durrani added a comment -

        The dataPaginator component uses following two properties of the dataTable to calculate pages.
        -first
        -rows

        The dataPaginator component maintains the "first" property of the dataTable internally, and its value changes according to the current page. Let say:

        • There are 100 rows in the dataTable
        • 10 rows per page
        • If page 1 is selected the "first" property of the dataTable will be set to "0".
          Now if you give any value less then 100 to the the "rows" attribute, the table will show you expected result.
        • If page 10 is selected then the "first" property will be set to "90" by the dataPaginator.
          Now only 10 rows can be rendered, regardless of the value of the "row" property.

        So its mean if the application wants to change the row attribute dynamically, it should also change the "first" property.

        (e.g.)
        <ice:dataTable binding="#

        {bean.table}

        " rows="#

        {bean.rows}

        " .../>

        public void change(ValueChangeEvent event)

        { .... rows = SOMTHING table.setFirst(ZERO_OR_SOMETHING) }
        Show
        Adnan Durrani added a comment - The dataPaginator component uses following two properties of the dataTable to calculate pages. -first -rows The dataPaginator component maintains the "first" property of the dataTable internally, and its value changes according to the current page. Let say: There are 100 rows in the dataTable 10 rows per page If page 1 is selected the "first" property of the dataTable will be set to "0". Now if you give any value less then 100 to the the "rows" attribute, the table will show you expected result. If page 10 is selected then the "first" property will be set to "90" by the dataPaginator. Now only 10 rows can be rendered, regardless of the value of the "row" property. So its mean if the application wants to change the row attribute dynamically, it should also change the "first" property. (e.g.) <ice:dataTable binding="# {bean.table} " rows="# {bean.rows} " .../> public void change(ValueChangeEvent event) { .... rows = SOMTHING table.setFirst(ZERO_OR_SOMETHING) }
        Hide
        Ken Fyten added a comment -

        I think the idea is to make it so that if the rows attribute is changed dynamically, it will automagically reset the first attribute.

        Show
        Ken Fyten added a comment - I think the idea is to make it so that if the rows attribute is changed dynamically, it will automagically reset the first attribute.
        Hide
        Adnan Durrani added a comment -

        The change has been made so the "rows" attribute is changed dynamically, will automagically reset the first attribute to 0.

        trunk revision: 18123

        Show
        Adnan Durrani added a comment - The change has been made so the "rows" attribute is changed dynamically, will automagically reset the first attribute to 0. trunk revision: 18123
        Hide
        Mandeep Hayher added a comment -

        The fix is not working if the number of rows is changed using a commandButton:
        <ice:commandButton id="button" value="Toggle 2-5" immediate="true" actionListener="#

        {bean.btnListen}

        "/>

        The fix works fine if inputText is used to change the number f rows:
        <ice:inputText value="#

        {bean.rows}

        "/>

        Show
        Mandeep Hayher added a comment - The fix is not working if the number of rows is changed using a commandButton: <ice:commandButton id="button" value="Toggle 2-5" immediate="true" actionListener="# {bean.btnListen} "/> The fix works fine if inputText is used to change the number f rows: <ice:inputText value="# {bean.rows} "/>
        Hide
        Adnan Durrani added a comment -

        Changes made so the first property gets set to 0, when the rows get changed dynamically either by any UIComponent.

        Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java
        Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java
        Completed: At revision: 18289

        Show
        Adnan Durrani added a comment - Changes made so the first property gets set to 0, when the rows get changed dynamically either by any UIComponent. Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java Completed: At revision: 18289
        Hide
        Mandeep Hayher added a comment -

        Tested successfully with ICEFaces1.8DR1 build4 on Jboss4.2 server.
        The number of rows can now be changed dynamically and the first attribuet is reset to 0.

        Show
        Mandeep Hayher added a comment - Tested successfully with ICEFaces1.8DR1 build4 on Jboss4.2 server. The number of rows can now be changed dynamically and the first attribuet is reset to 0.

          People

          • Assignee:
            Unassigned
            Reporter:
            Karl Arsch
          • Votes:
            7 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: