4 Replies Latest reply on Mar 17, 2008 9:14 AM by ilya_shaikovsky

    Objects in rich:comboBox

    andersun

      Hi all,

      How can i set Object in non-editable rich:comboBox??

      Thanks

        • 1. Re: Objects in rich:comboBox
          ilya_shaikovsky

          you could try to use your object but you have to define converter in this case

          • 2. Re: Objects in rich:comboBox
            andersun

            I have following:

            Car car = getCar();
            ...
            items.add(new SelectItem(car.getId(), car.getName()));
            ...


            and comboBox views list of Ids, but not car names, and in my Converter i should have Id to get car object

            • 3. Re: Objects in rich:comboBox
              aaexoun

              Hey Andersun,

              i faced the same problem when migrating from normal <h:selectOneMenu> to <rich:comboBox>. Somehow it swaps value and label, so insert the names first and it should be all fine

              Car car = getCar();
              ...
              items.add(new SelectItem(car.getName(), car.getId()));
              ...
              




              • 4. Re: Objects in rich:comboBox
                ilya_shaikovsky

                ComboBox - simplified client-side suggestion based component which designed to works only for string values out-of-the-box.

                ComboBox gets values from String collection defined in suggestionValues binding or the values could be defined using f:select* tags with value defined. In the second case - coboBox gets only value both for displaying and store result.