PrimeFaces' rowEditor doesn't work other than first try

360 Views Asked by At

I have a p:dataTable looks like this.

<p:remoteCommand name="rowEdit" action="#{servicesController.onRowEditCommand}" update="servicesTable" />
<p:remoteCommand name="rowEditCancel" action="#{servicesController.onRowEditCancelCommand}" update="servicesTable" />

<p:dataTable id="servicesTable"
             value="#{servicesController.services}" var="service" rowKey="#{service.id}"
             editable="true" editMode="row">

  <p:ajax event="rowEdit" listener="#{servicesController.onRowEdit}"
          oncomplete="rowEditCommand()"/>
  <p:ajax event="rowEditCancel" listener="#{servicesController.onRowEditCancel}"
          oncomplete="rowEditCancelCommand()"/>
  <p:ajax event="rowSelect" update=":mainMenu"
          listener="#{servicesController.sessionScopeServiceChanged}"/>

    <!-- other columns here -->

    <p:column style="width: 44px;">
      <p:rowEditor/>
    </p:column>

    <!-- other columns here -->

  </p:dataTable>

The p:rowEditor works fine for the first time. And it doesn't work from the second time. It gets to edit mode but the checkbox and x doesn't respond.

1

There are 1 best solutions below

0
Jin Kwon On

Two command names were wrong.

<p:remoteCommand name="rowEdit" ... />
<p:remoteCommand name="rowEditCancel" ... />

  <p:ajax ... oncomplete="rowEditCommand()"/>
  <p:ajax ... oncomplete="rowEditCancelCommand()"/>

I changed to.

<p:remoteCommand name="rowEditCommand" ... />
<p:remoteCommand name="rowEditCancelCommand" ... />

  <p:ajax ... oncomplete="rowEditCommand()"/>
  <p:ajax ... oncomplete="rowEditCancelCommand()"/>