ajax - primefaces selectonemenu change event not working for null value -


i have selectonemenu includes items. , null item showing "please choose one".. goal query data when select 1 of them. , if select "please choose one" thing.

but eventually, change event fired normal values if select "please choose one" item , not fired. help. here code.

<p:selectonemenu style="width: 200px" id="positionforward" value="#{hrprocesscontroller.querycriteria.positionforward}" converter="listconverter"                                              effect="fade" var="u" filter="true" filtermatchmode="startswith" validator="#{hrprocesscontroller.isopenpositionforwvalid}">                                 <f:selectitem itemlabel="#{menu['onemenu.choose']}" itemvalue="#{null}"/>                                 <f:selectitems value="#{hrprocesscontroller.positionlist}" var="position" itemlabel="#{position.name}" itemvalue="#{position}" />                                 <p:ajax event="change" listener="#{hrprocesscontroller.onpositionselect}" update="openpositionforward"/>                                  <p:column>                                     <h:outputtext value="#{u==null ? menu['onemenu.choose'] : u.name}" />                                 </p:column> </p:selectonemenu>      public void onpositionselect() {     if(querycriteria.getpositionforward()!=null)     {         openpositionquerycriteria criteria = new openpositionquerycriteria();         criteria.setposition(querycriteria.getpositionforward());         list<openposition> openpositions = openpositionservice.searchopenposition(criteria);         setopenpositionlist(openpositions);     }     else     {         list<openposition> positions = openpositionservice.getactiveopenpositionlist();         setopenpositionlist(positions);     } } 

if use itemvalue="#{null}" or itemvalue="", valuechangelistener method never called.

that's better approach if want first item null:

        <f:selectitem             itemdisabled="true"             itemlabel="#{null}"             itemvalue="#{null}" />  

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -