8 Replies Latest reply on Aug 3, 2009 7:22 AM by netdrag

    Extended Selection

    netdrag

      1.: Thank you for richfaces, it is great and beautiful

      2.: I am looking for something that behaves like a select component. I would like to populate it with a list of components, e.g. a userlist and ad a entityconverter. When I open it, it should work like the suggestionbox and show me multiple fields of my objects, e.g. user.firstname, user.lastname, user.username. But when I select one of the objects it should show me only one field e.g. user.username or a combination I say, like the suggestionbox does with fetchvalue.

      Does anybody know if this is possible with existing components?

      Thanks for any help

        • 1. Re: Extended Selection
          ilya_shaikovsky

          only suggestion box could be used as you described. But it's works with an input not select actually so you need to read about the ways to submit additional properties of object like id instead of label when using it. Visit dev guide and richfaces-demo to check.

          • 2. Re: Extended Selection
            netdrag

            Thank you, with your hint I was able to write

            <s:decorate template="layout/edit.xhtml" rendered="#{not empty applicationUserList.resultList}">
             <ui:define name="label">Assignee</ui:define>
             <a:outputPanel>
             <h:inputText id="assignee" immediate="false">
             <rich:suggestionbox id="assigneesuggestion" for="assignee"
             suggestionAction="#{applicationUserList.findByName}" var="_assignee"
             fetchValue="#{_assignee.username}" nothingLabel="No Users found" >
             <h:column>#{_assignee.firstname} #{_assignee.middlename} #{_assignee.lastname}</h:column>
             <h:column>#{_assignee.username}</h:column>
             <a:support event="onselect" ajaxSingle="true">
             <f:setPropertyActionListener value="#{_assignee}" target="#{invoiceHome.instance.assignee}" />
             </a:support>
             </rich:suggestionbox>
             </h:inputText>
             </a:outputPanel>
            </s:decorate>
            

            which works as aspected and saves the value in the database.

            But I forgot one thing, now it isn't able to load values form the bean. and when I add value="#{invoiceHome.instance.assignee}" to the input, I get problems with the converter...

            Have you another hint for me?

            Thanks or your help

            • 3. Re: Extended Selection
              netdrag

              I don't think its possible to do what I wanted to do with richfaces.
              Are there any plans to extend suggestionbox in this way, or better implement this as a new component?

              • 4. Re: Extended Selection
                ilya_shaikovsky

                 

                when I add value="#{invoiceHome.instance.assignee}" to the input, I get problems with the converter...


                And I'm wondering how the converter for your object which you have to to attach to input related to RF?

                • 5. Re: Extended Selection
                  netdrag

                  Oh sorry I wasn't clear.

                  I have no converter, so it is complaining about: summary=(Conversion Error setting value 'asdf' for 'null Converter'.)
                  Because there is no converter to convert a stringvalue to a company object.

                  If I use a converter it would interfere with the propertyactionlistener and overwrite the id I saved in the bean, wouldn't it?

                  • 6. Re: Extended Selection
                    netdrag

                    I tried different ideas but didn't fount a usable solution that works on loading and saving the value.

                    using a converter on the textbox overwrites what I save into the entity with the propertyactionlistener.

                    So is it worth creating a feature request for a select component with extendend information on open drop down? I think its a fast and good solution for selecting a single object from a long list of possibilities, for example selecting a product from a large list of products with different characteristics.

                    anyone else needing something like that or thinking its a good idea?

                    • 7. Re: Extended Selection
                      ilya_shaikovsky
                      • 8. Re: Extended Selection
                        netdrag

                        Thank you, great