圣杯 +获取 g:each 中的下一个值
我有一个这样的复选框列表:
<g:each in="${mylist}" var = "item" >
<tr>
<td colspan="2"><g:checkBox value="${dimension.id}" name="${item.id}"/> - ${item.name}</td>
</tr>
</g:each>
我必须更改它,以便每行有 2 列(每行 2 个复选框)
<g:each in="${mylist}" var = "item" >
<td> checkbox with item </td>
<td> checkbox with next item</td>
</g:each>
我不想为此编写标签,而且 scriptlet 选项看起来不太好。
有什么grailsy解决方案吗?
提前致谢
I have a list of checkboxes like this:
<g:each in="${mylist}" var = "item" >
<tr>
<td colspan="2"><g:checkBox value="${dimension.id}" name="${item.id}"/> - ${item.name}</td>
</tr>
</g:each>
I have to alter it so I get 2 columns in each row (2 checkboxes per row)
<g:each in="${mylist}" var = "item" >
<td> checkbox with item </td>
<td> checkbox with next item</td>
</g:each>
I wouldn't want to write a tag for this, and the scriptlet option does not look nice.
Is there any grailsy solution?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如何使用 status 属性:
除此之外,您可能会编写自己的 grails 标记。
您可以执行这样的操作将列表划分为数据对列表,然后调用每个都在该分区列表上。
当然,所有这些都可以在 GSP 中完成,只是将这些东西包装在标签中并远离视图总是更整洁。
How about using the status attribute:
Other than that, you're probably going to be writing your own grails tag.
You could do something like this to partiton your list into a list of pairs of data, then call each on that partitioned list.
All of this could be done in the GSP of course, it's just always neater wrapping these things in a tag and keeping out of the view.