简体   繁体   中英

How do I filter with more than one letter in primefaces selectonemenu?

I am using primefaces selectonemenu. As user request me to have the option to type more than one letter to have filtering, now it only works on one letter. is it possible?? I have extracted my code of the selectonemenu on the xhtml file. Hope it helps. Thanks for your help:

<p:selectOneMenu required="true" requiredMessage="#{esMessage['WARN.ESTTC3S5.COURSETYPE']}" id="ddCourseType" value="#{dtWebVoEsttc3s4.courseTypeId}" height="300" style="width:421px"
  onchange="subListUpdate();" effect="fade">

<p:ajax listener="#{dtSelectedCourseTitleVo.filterList(dtWebVoEsttc3s4.courseTypeId, dtCourseTitleVo)}" update="ddCourseTitle" />

<f:selectItem itemLabel="#{esLabel['lbl.esttc3s4.lblselectcoursetype']}" itemValue="" noSelectionOption="true" />

<f:selectItems value="#{dtCourseTypeVo.courseTypeList}" var="courseType" 
    itemLabel="#{language.localeString eq 'zh'? courseType.courseTypeChi: courseType.courseType}" itemValue="#{courseType.courseTypeId}"/>

</p:selectOneMenu>

........................................................



<p:remoteCommand id="teacherNameListRemoteCommandId"    
  name="subListUpdate" action="updateCourseTitleListData3s4Form"    
  update="ddCourseTitle" />

Why don't you use the filter option from selectOneMenu component?

filter="true" filterMatchMode="startsWith"

Source: http://www.primefaces.org/showcase/ui/input/oneMenu.xhtml

EDIT: Of course you can set the match mode to different options like contains or whatever you want

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM