繁体   English   中英

如何在p:datatable的最后一行呈现p:commandButton?

[英]How to render the p:commandButton at last row of the p:datatable?

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

我认为您最好使用<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>

我不知道我对功能的要求是否正确,但是据我了解,您想在表格底部添加一个commandButton,为此,您可以使用以下datatable标记:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM