Time for action – using DataTable with row editing support
Let us see how to use the DataTable component row editing feature:
- Create a DataTable component with the editable mode enabled by setting
editable
totrue
:<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}"...