1

I need to render the <p:commandButton> at last entry of the <p:datatable> only . consider if p:datatable having n no.of rows means i have render the p:commandButton at nth row only.

Arunprasad
  • 567
  • 4
  • 14
  • 29

2 Answers2

4

I think that you better use <f:facet name="footer">

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

But if you really insist on last row...

Try the rowIndexVar, something like this :

<p:dataTable value="#{myBean.myList}" rowIndexVar="rowIndex" var="item">
    <p:column>
        <p:commandButton rendered="#{(rowIndex+1) eq myBean.myList.size()}"/> 
    </p:column>
</p:dataTable>
Daniel
  • 36,833
  • 10
  • 119
  • 200
2

I don't know if I got the functional requirement right, but from what I understand you want to add a single commandButton at the bottom of the table, for that you might use the following inside datatable tags:

 <f:facet name="footer">
        <p:commandButton/>
 </f:facet>
Can Yegane
  • 514
  • 4
  • 11