10 Replies Latest reply on Jan 3, 2011 11:24 AM by mahi101987

    Rich Faces Suggestion Box fetch value ??

    mahi101987

      Hi,

       

      I am using rich faces suggestion box and i have tied this to an input text component.

       

      In the rich faces suggestion box we have an attribute called fetch value

       

      This fetch value will filter the data sent to the suggestion box.

       

      I need to change fetch value based on some other action output on this page.

       

      Is this possible ?

       

      Please suggest me a way to do so ..

       

      Thanks

      Mahendra

        • 1. Re: Rich Faces Suggestion Box fetch value ??
          dx89b

          can you post an example of do you want to do , because i don't know what you means with  "some other "

          • 2. Re: Rich Faces Suggestion Box fetch value ??
            mahi101987

            Like i mean

             

            when i click a radio button in my page , i want the suggestion box to fetch values of say "Name" criteria

             

            and when i click another radio button in the page , now i want suggestion box to retrieve data of say "Age" criteria.

             

            I hope You understood this

             

            Thanks

            Mahendra 

            • 3. Re: Rich Faces Suggestion Box fetch value ??
              dx89b

              yes , maybe i have a solution bean-side

               

              using radio button you can set a parameter inside the bean.

              now you can crate a set and a get like

               

              setFetchValue

              and

              getFetchValue

               

              like this

               

              getFetchValue(){

                   switch(radio_button_value){

                   case 1:return getName();

                   case 2:return getAge();

                   //and so on

              }

              }

               

              in the same way you can create the set

               

              in the suggestionbox you call

               

              fatchValue="#{mybean.fatchValue}"

               

              i think that this can work but i don't have time to test  it

              • 4. Re: Rich Faces Suggestion Box fetch value ??
                mahi101987

                Yeah thanks will check that out ,

                 

                By the way i have another question

                 

                After selecting a particular value from the suggestion list , how can i get that selected value back to my java bean ?

                 

                Thanks

                Mahendra

                • 5. Re: Rich Faces Suggestion Box fetch value ??
                  dx89b

                  i'm sorry but before i was in a mistake because

                   

                  this is the correct way to call this

                  h:inputText id="input_X" value="#{myBean.fatchValue}" />

                  rich:suggestionbox for="input_X"   fetchValue="#{result.fetchValue}"

                  suggestionAction="#{myBean.autocomplete}"

                  usingSuggestObjects="true"

                  var="result"

                  >

                   

                  in your autocomplete you have to set the radio_button_value on each item of the list because if not fetchValue="#{result.fetchValue}" return you the deflaut value of the case of.

                  • 6. Re: Rich Faces Suggestion Box fetch value ??
                    mahi101987

                    Could You Please Elaborate

                     

                    Thanks

                    Mahendra 

                    • 7. Re: Rich Faces Suggestion Box fetch value ??
                      ilya_shaikovsky

                      use a4j:support on onselect and pass the property you need using f:setPropertyActionListener to the bean.

                      • 8. Re: Rich Faces Suggestion Box fetch value ??
                        mahi101987

                        Hi Ilya ,

                         

                        Sorry to ask this ,

                         

                        That was a reply to which question

                         

                        If it was for the question on how to bring back the selected suggestion value back to the bean then i have one doubt

                         

                        I am doing the same way as you have suggested but for putting a value into the target attribute of the f:setPropertyActionListener i am sending a value of the same object used in the suggestion list .

                         

                        But this value is becoming null

                         

                        anyway to overcome this

                         

                        Thanks

                        Mahendra

                        • 9. Re: Rich Faces Suggestion Box fetch value ??
                          ilya_shaikovsky

                          please add your current code.

                          • 10. Re: Rich Faces Suggestion Box fetch value ??
                            mahi101987

                            one.JPG

                             

                            I am displaying an object value in the suggestion list

                             

                            say i have a person object , and i am displaying the person name in the suggestion list .

                             

                            Here i am able to view the person name

                             

                            but when i trying to set the same person name which i have selected into another variable , the problem is i am getting the previous selected person value as null

                             

                            the f:setProperty Action Listenet tag is also present within the rich suggestion tag.

                             

                            Image is attached for the sample code

                             

                            AnyIdea on how to solve the question asked in the first post ?

                             

                            Thanks

                            Mahendra