【问题标题】:How to render the p:commandButton at last row of the p:datatable?如何在 p:datatable 的最后一行呈现 p:commandButton?
【发布时间】:2013-02-23 13:54:19
【问题描述】:

我只需要在 <p:datatable> 的最后一个条目处渲染 <p:commandButton> 。 考虑 p:datatable 是否有 n 行意味着我只在第 n 行渲染了 p:commandButton

【问题讨论】:

    标签: jsf primefaces datatable commandbutton


    【解决方案1】:

    我觉得你最好用<f:facet name="footer">

        <f:facet name="footer">  
            <p:commandButton/> 
        </f:facet>  
    

    但如果你真的坚持最后一排...

    试试rowIndexVar,类似这样:

    <p:dataTable value="#{myBean.myList}" rowIndexVar="rowIndex" var="item">
        <p:column>
            <p:commandButton rendered="#{(rowIndex+1) eq myBean.myList.size()}"/> 
        </p:column>
    </p:dataTable>
    

    【讨论】:

    • 渲染而不是渲染
    • @user3586195 ,已修复,已发送
    【解决方案2】:

    我不知道我的功能要求是否正确,但据我了解,您想在表格底部添加一个命令按钮,因为您可以在数据表标签内使用以下内容:

     <f:facet name="footer">
            <p:commandButton/>
     </f:facet>
    

    【讨论】:

    • 我需要 2 显示 P:commandButton 在 p:datatable 的最后一个条目
    猜你喜欢
    • 2013-05-22
    • 2017-03-30
    • 2014-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-07
    • 1970-01-01
    相关资源
    最近更新 更多