tapestry component rendering order
I use Tapestry 4.1.1 and i need to change the order in wich some components are rendered in a tapestry application page. I have the following in HTML:
-start of page
-component1 (a map showing a location) -component2 (a resulttable contrib:table) -end of pagethe resulttable gets 90 objects to show. It is paged. 10 objects per page. 9 pages.
Becouse tapestry handles the sorting order of the objects i don't know wich objects will be displayed. I think i need to wait for it to render to know exactly what is being shown to the user?component1 shows a location on the map. It needs an identifier from one of the objects displayed in the resulttable. Not any identifier. one of the 10 being displayed out of all 90.
I use the 'row' binding setRow(Object 0) to know wich objects are displayed. The method gets called 10 times. This is perfect. I then need to pass the identifier to component1. Becouse in the HTML开发者_JAVA技巧 component1 comes before component2 it will be rendered before rendering the resulttable.
I tried placing component2 before component1 in the .page specification but that makes no difference. Only by putting component2 before component1 in the HTML did the trick.
i really hope someone can help me out here becouse i have been stuck for a while now and i really need to get this to work.
Thanks in advance for any help!!
Could this be done using JavaScript on the client side? What you want to do is much easier in Tapestry 5. In Tapestry 4 you can do some wierd tricks, like rendering the table first, capturing its output HTML, than inserting it later on the page.
Alternately, you could provide the correct model objects to the contrib:Table (rather than let it handle all the pagination work) and that way you'll know, before it renders, exactly what it will be rendering.
精彩评论