0 Replies Latest reply on Jun 25, 2011 3:48 AM by ssher

    rich:tree nodeSelectListener Problem

    ssher Newbie

      Hello buddies,

       

      I m getting a problem while selecting node, nodeSelectListener some times calls and sometimes not. i dont know why this happend here is the code.

       

       

       

      <rich:tree id="tree_a" ajaxSingle="true" nodeSelectListener="#{orgTreeManager.processSelection}"                                         

                                              ajaxSubmitSelection="true" switchType="client"

                                              value="#{orgTreeManager.treeNode}" var="item" >

                                      <rich:treeNode reRender="txt_msg,btn_save,txt_name,txt_addr,combo_level,combo_status,txt_email,txt_fax,txt_ph,txt_code,txt_desc,combo_dept,combo_site">                                                       

                                          <ajax:commandLink id="abc" value="#{item}" styleClass="textbold" />                                                                           

                                      </rich:treeNode>

       

       

      /*

      *processSelection call when node is selected , this method get the selected node id communicate with database to get record and populate form

      */

      public void processSelection(NodeSelectedEvent event){

             

              HashMap rdata = new HashMap();

             

              this.message = "";

              this.mode = "edit";

             

              HtmlTree tree = (HtmlTree) event.getComponent();

              this.orgName = (String) tree.getRowData();

              HMISUtils.printMessage(tree.getRowKey());

             

              String code = tree.getRowKey().toString();

              code = code.replace(':', '0');

              this.orgCode = "0".concat(code);

              HMISUtils.printMessage(this.orgCode);

             

              rdata.put(APP_OBJECT.ORGANIZATION, this.orgCode);       

              rdata = orgTreeProcessorLocal.processTree(rdata, APP_ACTIONS.FIND);       

              this.orgTreeEntity = (OrganizationTree) rdata.get(APP_OBJECT.TREE);       

             

              this.hospitalCode = this.orgCode.substring(0, 2);       

              rdata.put(APP_OBJECT.HOSPITAL, this.hospitalCode);           

              this.nodesList = (ArrayList) fkDataProcessorLocal.retrieveFKData(rdata, FK_ID.PARENT);

             

              if(this.orgCode.length() == 2){

                  this.parentCode = "";

                  this.orgParentStatus = "";

                 

                  this.levelList.clear();           

                  this.levelList.add(new SelectItem("S","Site"));

                 

              }else if(orgCode.length() > 2){

                  this.parentCode = orgTreeEntity.getOrganizationTree().getOrgCode();

                  this.orgParentStatus = orgTreeEntity.getOrgIsParentIa();

                 

                  this.levelList.clear();   

                 

                  if(orgTreeEntity.getOrgType().equalsIgnoreCase("R")){

                      this.levelList.add(new SelectItem("R","Reporting"));

                  }else if(orgTreeEntity.getOrgType().equalsIgnoreCase("O")){

                      this.levelList.add(new SelectItem("R","Reporting"));

                      this.levelList.add(new SelectItem("O","Operational"));

                  }       

                 

              }else{

                  this.parentCode = "";

              }

             

              this.orgCode = orgTreeEntity.getOrgCode();

              this.orgName = orgTreeEntity.getOrgName();

              this.orgAddress = orgTreeEntity.getOrgAddress();

              this.orgDesc = orgTreeEntity.getOrgDesc();

              this.orgPhoneno = orgTreeEntity.getOrgPhoneno();

              this.orgFax = orgTreeEntity.getOrgFax();

              this.orgEmail = orgTreeEntity.getOrgEmail();

              this.orgStatus = orgTreeEntity.getOrgStatus();

              this.orgType = orgTreeEntity.getOrgType();   

          }