Tapestry组件渲染顺序
我使用 Tapestry 4.1.1,我需要更改一些组件在 Tapestry 应用程序页面中呈现的顺序。 我在 HTML 中有以下内容:
-页面开始
-component1(显示位置的地图)
-component2(结果表贡献:表)
- 页末
结果表显示 90 个对象。它是分页的。每页 10 个对象。 9 页。
因为挂毯处理对象的排序顺序,所以我不知道将显示哪些对象。我想我需要等待它渲染才能确切地知道向用户显示的内容?
component1 显示地图上的位置。它需要结果表中显示的对象之一的标识符。没有任何标识符。显示所有 90 个对象中的 10 个对象之一。
我使用“行”绑定 setRow(Object 0) 来了解显示哪个对象。该方法被调用 10 次。这是完美的。 然后我需要将标识符传递给 component1。因为在 HTML 中,组件 1 位于组件 2 之前,它将在渲染结果表之前渲染。
我尝试在 .page 规范中将 component2 放在 component1 之前,但这没有什么区别。只有在 HTML 中将组件 2 放在组件 1 之前才能达到目的。
我真的希望有人能在这里帮助我,因为我已经被困了一段时间了,我真的需要让它发挥作用。
预先感谢您的帮助!
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 page
the 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 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!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可以在客户端使用 JavaScript 来完成吗?在 Tapestry 5 中,您想要做的事情要容易得多。在 Tapestry 4 中,您可以执行一些奇怪的技巧,例如首先渲染表格,捕获其输出 HTML,而不是稍后将其插入到页面上。
或者,您可以向 contrib:Table 提供正确的模型对象(而不是让它处理所有分页工作),这样您就可以在渲染之前确切地知道它将渲染什么。
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.