Reputation: 522
I've observed weird (however most likely it's expected) issue with Tapestry Grid component. Question will come in the end, after longer explanation.
When Grid is used inside of a loop, then pagination stops adding unique grid id to the pagination links. Simple example showing that behaviour
<t:numbersgrid max="literal:6"/>
<t:numbersgrid max="literal:6"/>
<t:loop source="numbers" value="number" index="index">
<t:numbersgrid max="index"/>
</t:loop>
First two numbersgrid components, get correct id. Pagination links are following .../T5sample/about.numbersgrid.grid.pager/2
and .../about.numbersgrid_0.grid.pager/2
which makes Grid behave correctly.
All grids inside loop get links like .../about.numbersgrid_1.grid.pager/2
which just does not work :/
Simplifying code (read: in line numbers grid)
<t:loop source="numbers" value="number" index="index">
<t:grid source="numbers" row="gridNumber" pagerPosition="bottom" rowsPerPage="2" t:add="number">
<p:numberCell>
${number}
</p:numberCell>
</t:grid>
does not help either. Effect is quite ... interesting, but that is just a good subject for another topic.
Thing that I don't understand, is why it does not work. It should be possible, but I don't even know where to start searching.
Question: Is there any way in which I could make it work. Is it even possible to make a patch for T5 (local change, not even in main repo), that would hallow that to work?
Thanks for any clues.
Upvotes: 1
Views: 645
Reputation: 27994
As you are probably aware, putting a component in a loop means that there's one instance of the component rendered multiple times. This is on of tapestry's principles of "static structure, dynamic behavior".
You have stumbled upon a limitation of the grid component. It really should accept a context parameter and pass the value to the serverside events (sorting, paging) to support use cases like this.
You can watch TAP5-2297 to track the progress. Or better yet, submit a patch with an appropriate test case.
Upvotes: 2