3 Replies Latest reply on Oct 7, 2011 8:08 AM by Ali Aafaq

    How to know which item is clicked in PichList

    Ali Aafaq Newbie

      I have a PickList and what I want is that when someone selects (mouse click) an item in the left list, some component in the form is updated based on what is clicked. I have managed to trigger an event in the bean whan some one clicks on an item. The code to achieve the trigger is 

       

      <rich:pickList showButtonsLabel="false" value="#{groupBean.pickListResult}"
                                              listHeight="100"  converter="#{groupBean.converter}">
                                              <a4j:ajax event="click" render="userlist" limitRender="true" listener="#{groupBean.updateGroupMembers}"/> 
                                              <f:selectItems value="#{groupBean.leftPickList}" />
                                 </rich:pickList>
      
      

       

      But I am not able to get the value of SelectItem which was clicked. Any idea how I can do that. I read in the documentation that each item has three states associated with it in the PickList i.e common, selected, active. So is there a way to get these states in the bean. Any idea.

        • 1. Re: How to know which item is clicked in PichList
          Ali Aafaq Newbie

          It is sad that no one know anything about this thing, I have been trying for th last three days and no a single thread has been answered. may be I wasted my three days on RichFaces.

          • 2. Re: How to know which item is clicked in PichList
            Akaine Harga Novice

            Try to remove listener attrbute from a4j:ajax and add the same logic to valueChangeListener to the rich:pickList (don't forget to change method's arguments). Then add execute="@this" to the a4j:ajax and play with its event types. Sometimes events are not of their JS counterparts but a built-in keywords that God knows where are to be found. Read carefully the RF4 online demo, sometimes they "pop up" in examples.

            • 3. Re: How to know which item is clicked in PichList
              Ali Aafaq Newbie

              thanks Akaine for the reply. I tried the approached you mentioned but the event is only fired when we click the button to move the item from left to right list. When I click on an item in a list nothing happens. Following is the code. Am i missing anything.

               

               

              <h:panelGrid id="groupMessage_Page">

                                         <rich:pickList id="group_picklist" showButtonsLabel="false" value="#{groupBean.pickListResult}"

                                                      listHeight="100"  converter="#{groupBean.converter}" valueChangeListener="#{groupBean.updateGroupMembers}">

                                                      <a4j:ajax event="click" render="userlist" limitRender="true" execute="groupMessage_Page"/>

                                                      <f:selectItems value="#{groupBean.leftPickList}"/>

                                         </rich:pickList>

                                         <a4j:commandButton value="#{msg.sendsms}" limitRender="true" execute="groupMessage_Page" render="group_picklist" action="#{groupBean.processGroupRequest}"/>

              </h:panelGrid>