Search This Blog

ADF ( Auto Suggest Behavior )

ADF ( Auto Suggest Behavior )



One of my project client needs auto suggest behavior. Just few line of code .


















Jspx Page Code :

  <af:inputText    value="#{pageFlowScope.callP6WebserviceMBean.selectedProjectList}" 
                            label="DeptName  " 
                            id="soc1">
  
<af:autoSuggestBehavior   suggestedItems="#{pageFlowScope.callP6WebserviceMBean.getSubProjectLists}"/> 
 </af:inputText>








Java Code :


 public List getSubProjectLists(String value) {
           
            value=value.toLowerCase();
            List<SelectItem> selectItems = new ArrayList<SelectItem>();
            Iterator itr = projectIdNameList.iterator();
               
               while(itr.hasNext()) {
                  
                     String projectname = (String)itr.next();
                     String pn=projectname;
                     projectname=projectname.toLowerCase();
                   
                         if(projectname.contains(value)){
                                      selectItems.add(new SelectItem(pn,pn)); 
                                      isProjectToRiskLable=false;
                          }
                }
             return selectItems;
    }


Note : ProjectIdNameList you have to know in advance.

No comments:

Post a Comment