【发布时间】:2013-02-23 13:54:19
【问题描述】:
我只需要在 <p:datatable> 的最后一个条目处渲染 <p:commandButton> 。
考虑 p:datatable 是否有 n 行意味着我只在第 n 行渲染了 p:commandButton。
【问题讨论】:
标签: jsf primefaces datatable commandbutton
我只需要在 <p:datatable> 的最后一个条目处渲染 <p:commandButton> 。
考虑 p:datatable 是否有 n 行意味着我只在第 n 行渲染了 p:commandButton。
【问题讨论】:
标签: jsf primefaces datatable 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>
【讨论】:
我不知道我的功能要求是否正确,但据我了解,您想在表格底部添加一个命令按钮,因为您可以在数据表标签内使用以下内容:
<f:facet name="footer">
<p:commandButton/>
</f:facet>
【讨论】: