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
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: WICKET-2376
                 URL: https://issues.apache.org/jira/browse/WICKET-2376
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.4-RC7
         Environment: Windows Vista, JDK 6 Update 14
            Reporter: Vikash Madhow


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., when it will 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;
    }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to