Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2376

In some cases, org.apache.wicket.extensions.markup.html.repeater.data.table.NavigatorToolbar is not displayed even when there are multiple pages in the DataTable it is attached to

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.4-RC7
    • None
    • wicket
    • None
    • Windows Vista, JDK 6 Update 14

    Description

      The following can recreate the problem:

      1. Create a DataTable with a NavigationToolbar and a page length less than what the data provider will return, i.e., the data table will have more than one page initially.

      2. Add two buttons to the page; the first one, when submitted, will change the criteria of the data provider to return less rows than what can be displayed in one page of the DataTable and reload the page, i.e., after pressing the button, the page will be reloaded with the datatable having only one page and, therefore, the NavigationToolbar will not be visible anymore.

      3. The second button will change the criteria of the data provider back to what it was originally, i.e., it will have more rows than can be displayed in one page of the DataTable, and reload the page. At that point, the NavigationToolbar should be shown again, but it isn't.

      I've found that the bug is due to the fact that the onBeforeRender() method of NavigationToolbar which have the following line for determining visibility of the toolbar:

      setVisible(table.getPageCount() > 1);

      is not called when the 2nd button is pressed in the above scenario.

      I've been able to work-around this problem by subclassing NavigationToolbar and overidding isVisible() method (which is called many times however, and might cause some performance problems) and added the above line of code as such:

      @Override
      public boolean isVisible()

      { return getTable().getPageCount() > 1; }

      Attachments

        Issue Links

          Activity

            People

              ivaynberg Igor Vaynberg
              kyrec Vikash Madhow
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: