[ 
https://issues.apache.org/jira/browse/WICKET-2376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12737305#action_12737305
 ] 

Kelsey Francis commented on WICKET-2376:
----------------------------------------

This is related to WICKET-2175. I'm experiencing this bug too.

The problem appears to be that callOnBeforeRenderIfNotVisible() in 
NavigationToolbar never gets called, because NavigationToolbar is contained 
within a DataTable.ToolbarContainer, which is itself contained in a 
DataTable.ToolbarsContainer.

ToolbarsContainer's isVisible() returns false, since it doesn't currently 
contain any visible toolbars, and since callOnBeforeRenderIfNotVisible() is not 
overridden in either ToolbarsContainer and ToolbarContainer, onBeforeRender() 
in those components is never called, and thus onBeforeRender() is never called 
in NavigationToolbar, so it remains hidden.

So, once NavigationToolbar is hidden, it never can become visible again. 

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

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