jsf 2 - f:ajax not rendering h:selectManyListbox -


using f:ajax component h:selectmanylistbox, firing listener method not refreshing rendering list.

i have market. when select market needs display sub-markets. initial page load have markets , sub-markets, needs filter when user selects "market".

using below code:

   <ui:fragment id="uda2" rendered="#{udalist.index eq 1}">    <div class=" row form-group" >                                   <label class="col-sm-2" for="sel-service">market:</label>    <div class="col-sm-10">           <h:selectmanylistbox style="width:360px;"   multiple="" pt:aria-required="true" required="required" pt:data-toggle="chosen"              disabled="#  {licenseselectionbean.isfieldenabled(formfieldsenum.item_uda2)}"            id="#{formfieldsenum.item_uda2.getfieldcode()}" size="1"            name="#{formfieldsenum.item_uda2.getfieldcode()}"         value="#{licenseselectionbean.selecteditemuda2}"                                                     styleclass="sel-chosen">          <f:selectitems var="uda2"             value="#{licenseselectionbean.selectuda2}" />         <f:ajax event="change" execute="@this" render="@this udalist3"                  listener="#{licenseselectionbean.onchangefilter()}" />      </h:selectmanylistbox>     </div>                                    </div>   </ui:fragment> <ui:fragment rendered="#{udalist.index eq 2}"> <div class="row form-group" >                            <label class="col-sm-2" for="sel-service">sub-market:</label> <div class="col-sm-10">       <h:selectmanylistbox style="width:360px;"   multiple="" pt:aria-required="true" required="required" pt:data-toggle="chosen"           disabled="#{licenseselectionbean.isfieldenabled(formfieldsenum.item_uda3)}"          size="1"         pt:name="udalist3"         value="#{licenseselectionbean.selecteditemuda3}"         pt:id="udalist3"                                                     styleclass="sel-chosen">          <f:selectitems var="uda3"             value="#{licenseselectionbean.selectuda3}" />         <!--  <f:ajax render="#{formfieldsenum.item_uda4.getfieldcode()}"                  listener="#{licenseselectionbean.onchangefilter()}" /> -->     </h:selectmanylistbox> </div>                                          </div>   </ui:fragment> 

used "pt" pass-through because jsf prefixing dynamic id.

how resolve problem?

simple solution. replace

<f:ajax event="change" execute="@this" render="@this udalist3"  listener="#{licenseselectionbean.onchangefilter()}" />  

with

<f:ajax event="change" execute="@this" render="@form"  listener="#{licenseselectionbean.onchangefilter()}" /> 

this might cause unnecesarry traffic. can encapsulate second ui:fragment in panelgroup, e.g.

<h:panelgroup id="wrapper">   <ui:fragment rendered="#{udalist.index eq 2}">    .... </h:panelgroup> 

and add replace "udalist3" "wrapper" in f:ajax render attribute.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -