0

What i want to do is like basic row selection example at Primefaces showcase(http://www.primefaces.org/showcase/ui/datatableRowSelectionByColumn.jsf) I want to update my datatable's row. The problem is when i click to update button at datatable, dialogbox appears with validation errors.

Second thing is what is the order of method execution times.(action-update-onclick-f:setPropertyActionListener)

<p:commandButton id="updateButtonId"
                                     action="#{myController.showCompanyEditPanel}"
                                     update=":tabView:companyForm:companyEditPanel"
                                     onclick="companyDialog.show()"                                         
                                     icon="ui-icon-pencil" title="update">  
    <f:setPropertyActionListener value="#{company}" target="#{myController.selectedCompany}" />  
</p:commandButton>


<p:dialog id="editCompanyDialogId" header="CompanyEdit" widgetVar="companyDialog" resizable="false">
    <p:panel id="companyEditPanel" >
    //some stuff here
    </p:panel>
</p:dialog>
skuntsel
  • 11,624
  • 11
  • 44
  • 67
Turgut Dsfadfa
  • 775
  • 6
  • 20
  • 42

1 Answers1

1

You seem to be missing a major point of using a <p:commandButton> here, as well as seem to be mixing client-side and server-side events.

First on <p:commandButton>. This component is designed to POST (partial) form data to the current URL, do business job in action(listener) method and return updated components / perform navigation. You can of course 'attach' JavaScript events to all those attributes.

Second, onclick, oncomplete, and other on... attribute are corresponding to some client-side events. In particular, onclick function is triggered when button was clicked, oncomplete function is called when DOM was updated after the AJAX call, i.e. the elements specified in <p:ajax update="..."> or simply in update="..." attribute of <p:commandButton>.

Third, all action listeners (thus, actionListener attribute, <f:actionListener> tag, <f:setPropertyActionListener> tag) will be executed right in the order they are specified in your tag, see this answer for more elaboration. The last one to be executed is action method, after which response is sent back.

Community
  • 1
  • 1
skuntsel
  • 11,624
  • 11
  • 44
  • 67