You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by nino martinez wael <ni...@gmail.com> on 2010/06/24 19:30:58 UTC

Re: inmethod custom PagingToolbar with dropdownchoice for setting rows not working correctly

I've had some strange things to, as the "delay" in choice you mentioned.
However in my case I had two grids(master/detail) on the same page, my
workaround was to create a new instance of the failing grid.. It had
something todo with a problem with datasources but I dont remember the
details now.

2010/6/24 Sam Zilverberg <sa...@gmail.com>

> Hi,
> First I'd like to say that inmethod grid is great, I've been using inmethod
> grid for a while and have been very satisfied with it!
> Major kudos to the creator/s!!
>
> The problem:
> I have a simple drop down choice to change the rowsPerPage:
>
> DropDownChoice<Integer> ddc = new DropDownChoice<Integer>("showPerPage",
> new
> PropertyModel<Integer>(
>                MyPagingToolbar.this, "ROWS_NUM"), Arrays.asList(20, 50,
> 100)) {
>            private static final long serialVersionUID =
> -8768375316550684005L;
>
>            @Override
>            protected boolean wantOnSelectionChangedNotifications() {
>                return true;
>            }
>
>            @Override
>            protected void onSelectionChanged(Integer newSelection) {
>                getDataGrid().setRowsPerPage(newSelection);
>            }
>
>        };
> add(ddc);
>
> This DDC works fine when it is located outside of the grid, just above it
> markup wise.
> I wanted to put this DDC  inside the paging toolbar so it will look better.
> I've created a MyPagingToolbar with the same code/markup as the
> PagingToolbar and added this component
> to the constructor and markup.
>
> The DDC doesn't work as expected this way, it is always one step behind of
> the grid.
> If I choose 50 rows per page, the grid reloads and only then the DDC model
> is changed to 50.
> The next time I choose 20 again, the grid loads 50 per page (the last ddc
> model) and only then
> changed the ddc model to 20...
>
> Anyone has any idea why this would happen?
>
> The only difference i find so far between the 2 methods - outside the
> grid/inside the toolbar - is that
> when the ddc is inside the toolbar it is also inside a form - a filter form
> i use along with the grid because i've
> created a filter toolbar
>
> -Sam.
>