行表格的行计数器 [英] row counter for html table row

查看:135
本文介绍了行表格的行计数器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JSF Web应用程序中有HTML表格。我正在使用< ui:repeat> 动态地生成行。我想为每一行提供一个计数器。我怎样才能得到这个?任何帮助?

I have HTML table in JSF web application. I am generating rows dynamically using <ui:repeat>. I want a counter for each row. How can I get this? Any help?

类似于在rich faces dataTable中的rowKeyVar。

Ssimilar to rowKeyVar in rich faces dataTable.

推荐答案

由于您使用的是richfaces,因此您可以使用它的迭代标记(< a4j:repeat> )来实现,这比使用< c:forEach> ,它就像是对< ui:repeat>的扩展

Since you are using richfaces, you can do it with its iteration tag (<a4j:repeat>), which is a bit more appropriate than using <c:forEach>, and which is like an extension to <ui:repeat>

<table>
    <a4j:repeat value="#{bean.list}" var="item" rowKeyVar="idx">
        <tr>
            <td><h:outputText value="#{idx + 1}" /></td>
            <td><h:outputText value="#{item.someProperty}" /></td>
            <td><h:outputText value="#{item.otherProperty}" /></td>
        </tr>
    </a4j:repeat>
</table>

这篇关于行表格的行计数器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆