You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by helmers <gu...@GMAIL.COM> on 2009/03/20 19:32:24 UTC

Re: DataTable testability - RepeatingView.childIdCounter not reset after a page refresh

I solved it as follows:

dataTable.setItemReuseStrategy(new ReuseIfModelsEqualStrategy());

This will prevent the table from creating new items over and over again,
even if they represent the same object. See the javadoc for
ReuseIfModelsEqualStrategy.



helmers wrote:
> 
> I have a page with a DefaultDataTable containing an AjaxFallbackLink in
> one
> of its columns. When the page is rendered for the first time, the link in
> row 1 has component id path "table:rows:1:cells:3:cell". When I click this
> link while Ajax is disabled, the page is refreshed, and now the link in
> row
> 1 (which is still displaying exactly the same item) has changed to
> "table:rows:3:cells:3:cell" (my table has 2 rows, hence the row id
> increase
> from 1 to 3).
> 
> In my data table tests I would like to refer to data table rows and cells
> by
> their component id paths (see DataTablePageTest.java). Currently my tests
> are not very robust, because the component id paths of the DataTable rows
> and cells vary over time and depend on the page size and number of items
> displayed (if page size = 2, after a click, row id 1 has suddenly become 1
> +
> 2 = 3).
> 
> The reason that in case of no ajax the row ids increase, is that on a page
> refresh the DataGridView.onPopulate() is called, and if you look in
> RefreshingView.onPopulate() -> newItemFactory() you will see that a new
> child id is retrieved for every item. Because childIdCounter is a private
> field of RepeatingView, and the counter is never reset to 0, my row #1 has
> suddenly become row #3.
> 

-- 
View this message in context: http://www.nabble.com/DataTable-testability---RepeatingView.childIdCounter-not-reset-after--a-page-refresh-tp22568486p22626268.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org