jsf - PrimeFaces ManyCheckbox ArrayList not Updating inside modal dialog -


i have modal dialog, user can select , deselect roles based on user , submit database updated.

however, after debugging, arraylist backs manycheckbox doesn't updated, , selectedroles arraylist remains was.

for example:

  1. i load application

  2. there 1 user in database role 'admin'

  3. i try edit user , dialog opens up, 'admin' checkbox selected.

  4. i click 'user' role checkbox , click submit

  5. the selectedroles array still 'admin' instead of 'admin' , 'user'

here dialog modal:

<p:dialog header="editing user id: #{usersview.viewuser}" id="edituserdialog" widgetvar="edituserdialog" modal="true" appendto="@(body)">     <h:form id="edituserform">         <p:selectmanycheckbox id="roleselect" value="#{usersview.selectedroles}" layout="grid" columns="3">             <f:selectitems value="#{rolesview.roles}" var="role" itemlabel="#{role.name}" itemvalue="#{role.name}" />         </p:selectmanycheckbox>         <p:separator />         <p:commandbutton process="@this" update=":form:tabs:adminview:usertable:userroleoutput" value="submit" id="editusersubmitbutton" actionlistener="#{usersview.edituserrole}" oncomplete="pf('edituserdialog').hide();" />     </h:form> </p:dialog> 

userview:

@managedbean(name="usersview", eager=true) @applicationscoped  private arraylist<string> selectedroles;  public arraylist<string> getselectedroles() {     return this.selectedroles; }  public void setselectedroles(arraylist<string> roles) {     this.selectedroles = roles; }  public void edituserrole(actionevent actionevent) {     // method literally loops through users , matches 1 we're looking @     user user = finduser();      if (user != null)     {         // gives user checked roles in database , local session         addselectedroles(user);          arraylist<string> rolestoremove = user.getrolenames();         rolestoremove.removeall(selectedroles);          // removes user unchecked roles in database , local session         removeselectedroles(user, rolestoremove);     }      else     {         // handle exception...     } } 

i working on restricted vm, cannot copy , paste , information can post, believe enough.

any appreciated.

i solved issue removing process="@this" , arraylist getting updated.

process="@this" means current component of commandlink , hence why wasn't updating.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -