6 Replies Latest reply on May 28, 2014 7:21 AM by toniaca

    rich:picklist using f:ajax wired to the event "change" does nothing

    roet42

      I wanted to know if anyone has succesfully wired an ajax behaviour to a picklist component on the change event.

       

      This is an example:

      <rich:pickList value="#{listSelectBean.selectedCapitals}"
                     listWidth="170px" listHeight="100px"
                     orderable="true">
      <f:selectItems value="#{listSelectBean.capitals}" var="capital" itemValue="#{capital}" itemLabel="#{capital.name}" />
      <f:ajax event="change" execute="@this" render="dependentFields"/>
      </rich;picklist>

       

      Any suggestions on how to implement a client behaviour upon the pick list value change would be appreciated.

        • 1. Re: rich:picklist using f:ajax wired to the event "change" does nothing
          bleathem

          Can you try attaching a client-side listener with the "onchange" attribute and verify that it is firing? 

           

          If the client side listener fires, but the nested f:ajax behaviour does not, then it's a bug.

          • 2. Re: rich:picklist using f:ajax wired to the event "change" does nothing
            roet42

            I did add an a4j:log to the page.  When I specify the event as anything other than change I can see the events firing within the log component.  When the event attribute is specified nothing is displayed in the a4j:log component.  I am adding values to the selected list, removing them, changing focus to different components even submiting the form.  As long as the event is :change" it does not seem like the ajax events are firing.

            • 3. Re: rich:picklist using f:ajax wired to the event "change" does nothing
              roet42

              Brian you suggestion was very helpful adding an onchange event handler on the component does not produce any effect.  onchange="alert('Changed');" does nothing while onclick="alert('Clicked');" behaves as expected.  I will try and determine if a bug has been submitted for this already.

              • 4. Re: rich:picklist using f:ajax wired to the event "change" does nothing
                bleathem

                Thanks R Etler, looks like you've found a bug.  Please go ahead an file a jira issue, and we'll look at getting this resolved in an upcoming release.

                • 5. Re: rich:picklist using f:ajax wired to the event "change" does nothing
                  deva_online

                  Replaced 'change' event with 'additems, removeitems, sourceblur, sourcefocus, targetblur and targetfocus' events and it worked for me. There could be some redundant code in this temporary fix but it solved the problem at least. Suggestions are always welcome. Thanks.

                   

                   

                  Old ( change event doesn't work):

                  <rich:pickList ...>

                       <f:ajax event="change" .. />

                      

                       <f:selectItems.. />

                       <f:converter converterId="someConverter" />

                  </rich:pickList>

                   

                  New (works):

                  <rich:pickList ...>

                       <f:ajax event="additems" .. />
                       <f:ajax event="removeitems" .. /> 
                       <f:ajax event="sourceblur" .. />
                       <f:ajax event="sourcefocus" .. />
                       <f:ajax event="targetblur"  .. />
                       <f:ajax event="targetfocus" ..  />

                      

                       <f:selectItems.. />

                       <f:converter converterId="someConverter" />

                  </rich:pickList>

                   

                   

                  I hope this helps.

                   

                  Versions:

                  RichFaces 4.2

                  JSF 2.1.7

                  • 6. Re: rich:picklist using f:ajax wired to the event "change" does nothing
                    toniaca

                    I would like to add that the event ajax of order columns not working.

                     

                    The list have the columns in the same order as I put. If I change the order of columns the list never change.

                     

                    Can someone help me?

                     

                    Thanks.

                     

                    Versions

                    RichFaces 4.3.6

                    JSF 2.1.23