【问题标题】:Number of Item in DataTable - Primefaces?DataTable 中的项目数 - Primefaces?
【发布时间】:2013-09-17 22:25:11
【问题描述】:

是我上传了来自BD的数据我的DataTable,但是我需要将加载数据的行号放在我的Grid中。

<p:dataTable id="dataTable" var="rol" value="#{mantRolMB.roles}"  
         paginator="true" rows="10"  
         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks}
         {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
         rowsPerPageTemplate="5,10,15" rowKey="#{item}" >  

<p:column>  
    <f:facet name="header">  
        <h:outputText value="N°" />  
    </f:facet>  
    <h:outputText value="#{item}" />  
</p:column>  

<p:column>  
    <f:facet name="header">  
        <h:outputText value="Nombre Corto" />  
    </f:facet>  
    <h:outputText value="#{rol.nbNomCorto}" />  
</p:column>  

<p:column>  
    <f:facet name="header">  
        <h:outputText value="Nombre Largo" />  
    </f:facet>  
    <h:outputText value="#{rol.nbNomLargo}" />  
</p:column>  

</p:dataTable>

请帮忙加载一个项目编号。

【问题讨论】:

  • 你的意思是喜欢使用rowIndexVar吗?也许this 可以帮助你。

标签: jsf primefaces


【解决方案1】:

你可以定义rowIndexVar="rowIndex",然后像这样使用它:&lt;h:outputText value="#{rowIndex}" /&gt;

【讨论】:

    猜你喜欢
    • 2017-01-12
    • 2016-01-03
    • 2011-05-02
    • 1970-01-01
    • 1970-01-01
    • 2012-06-06
    • 2013-01-20
    • 2013-10-21
    • 1970-01-01
    相关资源
    最近更新 更多