2014-10-21 1 views
0

사용자 목록을 기반으로 권한 목록을 채우는 구성 요소를 만들고 있습니다. 사용자 이름을 클릭하면 다른 목록이 채워집니다.p : selectOneListbox에 변경 이벤트 추가

샘플 코드 :

(.xhtml 파일)

<h:form id="rolesRightsCustomizerForm"> 
     <!-- #{msgs.select_role} --> 
     <p:panelGrid id="rolesRightsCustomizerPanel" columns="3"> 
      <p:selectOneListbox id="selectRoleList" 
       value="#{cc.attributes.controller.rolesRightsCustomizer.selectedRole}" 
       converter="entityConverter" immediate="true"> 
       <f:selectItems var="role" 
        value="#{cc.attributes.controller.rolesRightsCustomizer.roles}" 
        itemLabel="#{role.role_desc}" itemValue="#{role}" /> 
       <p:ajax event="change" 
        process="rolesRightsCustomizerForm:rolesRightsColumnsPicklist" 
        update="rolesRightsCustomizerForm:rolesRightsColumnsPicklist" 
        listener="#{cc.attributes.controller.rolesRightsCustomizer.reinit}" /> 
      </p:selectOneListbox> 

      <p:pickList id="rolesRightsColumnsPicklist" 
       render="#{cc.attributes.controller.rolesRightsCustomizer.selectedRole != null}" 
       value="#{cc.attributes.controller.rolesRightsCustomizer.columns}" 
       var="column" effect="none" itemLabel="#{column.column_description}" 
       converter="entityConverter" itemValue="#{column}"> 
       <f:facet name="sourceCaption">#{msgs.hiddenColumnsList}</f:facet> 
       <f:facet name="targetCaption">#{msgs.shownColumnsList}</f:facet> 
      </p:pickList> 
     </p:panelGrid> 

RolesRightsCustomizer 클래스 :

public class RolesRightsCutomizer implements Serializable{ 
    private List<Role> roles; 
    private Role selectedRole; 
    private RoleService roleServ = new RoleService(); 
    private DualListModel<Column> columns; 


... 


    public DualListModel<Column> getColumnsState() { 

    //Get all columns of the view and return the new list 
    return new DualListModel<Column>(source, target); 
    } 

    public void reinit() { 
    log.info("reinit method call"); 
    log.info("Reinitializing the user_rights object"); 
    user_rights = new UserRights(selectedRole); 
    columns = getColumnsState(); 
    log.info("NEW ROLE:" + selectedRole.getRole_desc() + "\t" + columns.toString()); 
    } 

//getters and setters 
... 

} 

가 왜 REINIT하지 않습니다() 함수 해고?

답변

1

추가 시도 @this<p:ajax>

process="@this rolesRightsCustomizerForm:rolesRightsColumnsPicklist" 
의 속성 process