7 Replies Latest reply on Aug 6, 2010 4:53 AM by Rinuz _K

    h:selectOneMenu doesn't rerender

    Rinuz _K Newbie

      Hi,

      I have some problem with rerendering h:selectOneMenu. I have three selectOneMenu. When I selectsome valu from first, second and third should rerender. Here is my code:

       

      <rich:panel header="Form" id="form">
           <rich:messages>
                <h:form>
                     <h:selectOneMenu id="wojewodztwo" converter="comboboxConverter">
                          <f:selectItems value="#{testHolder.itemListsMap['country']}" />
                          <a4j:support event="onchange" reRender="form" ajaxSingle="true"
                                          actionListener="#{testHolder.comboboxListener}" />
                     </h:selectOneMenu>
                     <h:selectOneMenu id="powiat" converter="comboboxConverter">
                          <f:selectItems value="#{testHolder.itemListsMap['state']}" />
                          <a4j:support event="onchange" reRender="form" ajaxSingle="true"
                               immediate="true" actionListener="#{testHolder.comboboxListener}" />
                     </h:selectOneMenu>
                     <h:selectOneMenu id="gmina" converter="comboboxConverter">
                          <f:selectItems value="#{testHolder.itemListsMap['city']}" />
                          <a4j:support event="onchange" reRender="form" ajaxSingle="true"
                               immediate="true" actionListener="#{testHolder.comboboxListener}" />
                     </h:selectOneMenu>
                </h:form>
           </rich:messages>
      </rich:panel>

       

      I know that after selection value from first selectOneMenu, lists of SelectItem ( testHolder.itemListMaps[state] and testHolder.itemListMaps[state]) has new values. But component doesn't rerender. I don't know why, because f:selectItem value is pointing on new values. What I am doing wrong?

       

      Thank you in advance

        • 1. Re: h:selectOneMenu doesn't rerender
          Rinuz _K Newbie

          sory for text formatting. here is my code again:

           

          <rich:panel header="Form" id="form">
                              <rich:messages>
                                  <h:form>
                                      <h:selectOneMenu id="country" converter="comboboxConverter">
                                          <f:selectItems value="#{testHolder.itemListsMap['country']}" />
                                          <a4j:support event="onchange" reRender="form" ajaxSingle="true"
                                              actionListener="#{testHolder.comboboxListener}" />
                                      </h:selectOneMenu>
                                      <h:selectOneMenu id="state" converter="comboboxConverter">
                                          <f:selectItems value="#{testHolder.itemListsMap['state']}" />
                                          <a4j:support event="onchange" reRender="form" ajaxSingle="true"
                                              immediate="true"
                                              actionListener="#{testHolder.comboboxListener}" />
                                      </h:selectOneMenu>
                                      <h:selectOneMenu id="city" converter="comboboxConverter">
                                          <f:selectItems value="#{testHolder.itemListsMap['city']}" />
                                          <a4j:support event="onchange" reRender="form" ajaxSingle="true"
                                              immediate="true"
                                              actionListener="#{testHolder.comboboxListener}" />
                                      </h:selectOneMenu>
                                  </h:form>
                              </rich:messages>
                          </rich:panel>

          • 2. Re: h:selectOneMenu doesn't rerender
            Ilya Shaikovsky Master

            it happens after you already made some changes in child selects? Or just after rendered on first time select change? If after some changes in the child selects - remove immediate from the supports of those selects. 

             

            In general the code looks fine and similar to http://livedemo.exadel.com/richfaces-demo/richfaces/support.jsf?tab=selects&cid=232785.. But in our case it works :/

             

            B.t.w. what is your RF version?

            • 3. Re: h:selectOneMenu doesn't rerender
              Rinuz _K Newbie

              Thanks IIya for your response.

              So I run my app and I select row from first selectOneMenu and then list of select items for second and third menu are reloaded.

               

              <f:selectItems value="#{testHolder.itemListsMap['state']}" />
              <f:selectItems value="#{testHolder.itemListsMap['city']}" />

               

              Old list are cleared and i put to them a new values. I know that there are new values but second and third  selectOneMenu are not response (not rerendered). I don't know why. And when I select row from second menu i have NullPointerExc because in the list of select items are new values.

              It's looks like only selectOneMenus don't want to rerender.

              I use RF 3.3.1.GA.

               

              Thanks

              • 4. Re: h:selectOneMenu doesn't rerender
                Ilya Shaikovsky Master

                do you able to create and share simple and complete Bean and page code to just insert into my local application and try?

                • 5. Re: h:selectOneMenu doesn't rerender
                  Rinuz _K Newbie

                  I will try and I hope it helps. Thanks

                  • 6. Re: h:selectOneMenu doesn't rerender
                    liumin hu Master

                    hi,

                     

                    your problem is more like synchro between the view and object. Do your try use a simple attribute to replace the map for f:selectItems?

                     

                    liu

                    • 7. Re: h:selectOneMenu doesn't rerender
                      Rinuz _K Newbie

                      I used rich:combobox component and now it's work.

                       

                      Thanks