提升片段之间的数据传递
我是 scala/lift 的新手,我正在尝试找出解决这个特定问题的最佳方法:
我正在创建一个页面来显示多个“族”的结构。我使用 Lift 的 TreeView 小部件将每个家庭表示为一棵树。我的计划是有一个片段可以生成家庭列表,另一个片段可以呈现单个家庭的 TreeView,并且每个家庭都会调用它。
列表片段生成列表的最佳方式是什么,以便树视图片段可以访问家庭 ID 来为每个家庭构建树?
谢谢。
I am new to scala/lift and I am trying to figure out the best way to solve this particular problem:
I am creating a page to display the structure of multiple "families". I am representing each family as a tree using Lift's TreeView widget. My plan was to have one snippet that would generate the list of families, and another snippet that would render the TreeView of a single family, and it would get called for each family.
What is the best way for the list snippet to generate the list so that the treeview snippet can have access to the family id to build the tree for each family?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够通过嵌套两个片段来做到这一点。在下面的示例中,
families
代码段返回将 bindFamily 代码段应用(并连接其结果)到每个系列的结果。XML:
以及相应的Scala代码:
You should be able to do this by nesting your two snippets. In the example below, the
families
snippet returns the result of applying (and concatenating the result of) the bindFamily snippet to each of the families.The XML:
And the corresponding Scala code: