O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – using DataTable with row editing support

Let us see how to use the DataTable component row editing feature:

  1. Create a DataTable component with the editable mode enabled by setting editable to true:
    <p:dataTable id="usersTbl" var="user" value="#{adminController.users}" editable="true">  
      <p:ajax event="rowEdit" listener="#{adminController.onEdit}"/>  
      <p:ajax event="rowEditCancel" listener="#{adminController.onCancel}"/> <p:column headerText="Email"> <h:outputText value="#{user.emailId}" /> </p:column> <p:column headerText="FirstName"> <p:cellEditor> <f:facet name="output"> <h:outputText value="#{user.firstName}" /> </f:facet> <f:facet name="input"> <p:inputText value="#{user.firstName}"/> </f:facet> </p:cellEditor> </p:column> <p:column ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required