11 Replies Latest reply on Jul 3, 2010 1:38 AM by luiggitama

    rich:comboBox and s:convertEntity

    maumau

      Dear all,

      As stated in chapter 6.28.2. of the RichFaces Developer Guide,
      one off the key features of the rich:combobox is the
      Seam entity converter support.

      So I'm trying the following

      <rich:comboBox id="lstIndustry1" defaultLabel="Select your industry">
       <s:selectItems value="#{selectIndList.list}" var="ind" label="#{ind.industry}" />
       <s:convertEntity />
      </rich:comboBox>
      


      This code works perfectly with "h:selectOneMenu" but with the comboBox
      I'm just getting the list of id's (from 1 to 12) and not the Industry name as expected.

      What am I doing wrong ?

      In advance, thank you for your support.

      Sincerely

      Malte Wiskott




        • 1. Re: rich:comboBox and s:convertEntity
          maumau

          No answer...

          Should I open a bug report for this ?

          Malte Wiskott

          • 2. Re: rich:comboBox and s:convertEntity

            Could you please attach your java beans. I can't reproduce this issue under Jboss 4.2.1.GA server & 2.0.2 Seam

            • 3. Re: rich:comboBox and s:convertEntity
              maumau

              Hi,
              Thank you for your answer.

              I'm using
              Seam 2.0.3.CR1
              Jboss 4.2.1.GA
              Richfaces 3.2.1.GA

              Here is the bean.

              @SuppressWarnings("serial")
              @Name("selectIndList")
              @Stateless
              public class SelectIndList implements SelectStatelessListBean {
               @Logger
               Log log;
              
               @In
               EntityManager entityManager;
              
               @In Context sessionContext;
              
               @In (required = false, create = false)
               SService selectedService;
              
               @SuppressWarnings("unchecked")
               public List getList()
               {
               if (selectedService==null)
               return null;
              
               Query query = entityManager.createQuery("SELECT ind FROM AInd ind " +
               "WHERE ind.indid in " +
               "(SELECT DISTINCT ur.id.indid " +
               "FROM IUser2right ur " +
               "WHERE ur.id.userid=" + sessionContext.get("userId") +
               " AND ur.id.rightid=" + Constants.RightIndustry +
               " AND (ur.id.serviceid='" + selectedService.getServiceid()+ "' or ur.id.serviceid='global')) " +
               "ORDER BY lower(ind.ind)");
               return(query.getResultList());
              
               }
              
               @Remove
               public void destroy() {
               log.info("********************************* destroyed") ;
               }
              
              
              }
              


              Pretty simple...

              Maybe I should try with seam 2.0.2 ?

              Thank you for your support

              Malte Wiskott


              • 4. Re: rich:comboBox and s:convertEntity

                Java beans aren't needed. Bug https://jira.jboss.org/jira/browse/RF-4293 was posted in JIRA.

                Thanks for the collaboration.

                • 5. Re: rich:comboBox and s:convertEntity

                  This bug was reproducible under jboss 4.2.1.GA server, seam 2.0.2 & richfaces 3.2.2.BETA5. So I think seam 2.0.2 will not help you.

                  • 6. Re: rich:comboBox and s:convertEntity
                    maumau

                    Thank you for your fast reply

                    Sincerely
                    Malte Wiskott

                    • 7. Re: rich:comboBox and s:convertEntity
                      nbelaevski

                      Malte,

                      rich:comboBox is not a select component by nature. Combo box ignores itemLabel attribute, only itemValue is used, e.g.:

                      <rich:comboBox>
                       <f:selectItem itemValue="1" itemLabel="l1" />
                       <f:selectItem itemValue="2" itemLabel="l2" />
                       <f:selectItem itemValue="3" itemLabel="l3" />
                       <f:selectItem itemValue="4" itemLabel="l4" />
                       <f:selectItem itemValue="5" itemLabel="l5" />
                       </rich:comboBox>
                      produces 1..5 in the dropdown, but not the l1...l5 as someone can expect. The same is true for s:selectItems. That is not a bug, but a component feature.

                      Please use rich:inplaceSelect component if you need RichFaces-styled select menu or use more meaning values for item IDs so that the user can input them manually.

                      • 8. Re: rich:comboBox and s:convertEntity
                        maumau

                        Nick,

                        Thank you for your investigations, but I'm a bit disappointed and don't quite understand the main difference between rich:comboBox and rich:inplaceSelect.

                        But if it is that clear and that there is not hope for evolution, there is a need to change the doc

                        As stated in chapter 6.28.2. of the RichFaces Developer Guide,
                        "one off the key features of the rich:combobox is the Seam entity converter support."

                        Sincerely

                        Malte Wiskott

                        • 9. Re: rich:comboBox and s:convertEntity
                          maumau

                          Nick,

                          Sorry, it took 5 minutes to understand the difference and now it's perfectly clear.

                          I mixed up the combo box and the drop down concept.

                          Thank you for clarification.

                          Sincerely

                          Malte Wiskott

                          • 10. Re: rich:comboBox and s:convertEntity
                            deanhiller

                            This component could go forward now if you vote for it!!!!

                            https://jira.jboss.org/jira/browse/RF-5046

                            • 11. Re: rich:comboBox and s:convertEntity
                              luiggitama

                              Hi guys...

                               

                              rich:combobox does what it was designed to (an input text component with client-side suggestions).

                               

                              If we want to use it for selecting of values based on selected labels (rendered by the component), we must wait for a new component to be designed (or design it)... or enhance it on the client-side (as I did)...

                               

                              In this article I share my (working) approach:

                               

                              Enhanced rich:comboBox: Values (not only Text) and RegExp Suggestions
                              http://community.jboss.org/docs/DOC-15534

                               

                              So please test it and let me know what you think.

                               

                              God bless you.

                               

                              Best regards,
                              Luis Tama