3 Replies Latest reply on Aug 26, 2010 1:28 PM by Cássio Nandi Citadin

    rich:comboBox shows strange results

    adelchi valenti Newbie

      Hi, guys. i'm a newbe in java and i need your help.

       

      The Problem

       

      I extract the results from a query (15 records):

       

      public List<Soggetto> getAllSoggetti() {
              List<Soggetto> menuList = entityManager.createQuery("Select n from Soggetto as n").getResultList();
              return menuList;   
          }

       

      If I use h:selectOneMenu, it works. Instead , if I use rich:comboBox the results are displayed in a strange way. combobox dislpays for 15 time  com.mydomain.pkg.model.Soggetto@61 as result .

       

      See the 2 example

       

      DON'T WORK

       

      <rich:comboBox selectFirstOnUpdate="false" directInputSuggestions="true" defaultLabel="Enter some value">
            <s:selectItems var="thing" value="#{extractor.allSoggetti}" label="#{thing.codiceFiscale}  #{thing.cognome}  #{thing.primoNome}   #{thing.secondoNome}  #{thing.ragioneSociale}" noSelectionLabel="Selezionare un soggetto destinatario" hideNoSelectionLabel="true"  />
      </rich:comboBox>

       

      s_ko.jpg

       

      ======================================================================================================

       

      WORKS

       

      <h:selectOneMenu value="#{comunicazione.destinatario}" required="true">
                          <s:selectItems var="thing" value="#{extractor.allSoggetti}" label="#{thing.codiceFiscale}  #{thing.cognome}  #{thing.primoNome}  #{thing.secondoNome}  #{thing.ragioneSociale}" noSelectionLabel="Selezionare un soggetto destinatario" hideNoSelectionLabel="true"/>
                          <s:convertEntity/>
                     </h:selectOneMenu>

       

      s_ok.jpg

       

      Someone can help me, please ?

       

      Thanks in advance