6 Replies Latest reply on Sep 16, 2009 11:22 PM by valatharv

    Editable dropdown to implement in seam project

    valatharv

      Hi,


      We have a requirement to provide a editable dropdown/combo-box where users should be able to add values to it.


      Please suggest best way to implement it. Is there any richfaces component which can handle it... I tried but not able to find.


      Regards
      Val

        • 1. Re: Editable dropdown to implement in seam project
          chopin

          Hi,


          maybe the selectInputText tag of the ICEfaces project fits?


          http://www.icefaces.org/docs/latest/tld/ice/selectInputText.html


          You can implement a value change listener to update the list on basis of the entered letters. The content of the drop down list may be taken from another table which may be editable for the users. If you do not have to much entries, the plain JSF selectItems tag may also help?


          Stefan


          • 2. Re: Editable dropdown to implement in seam project
            valatharv

            Thanks for the response Stefan...


            We already have a application in production which uses richfaces 3.1.4.GA.
            Env: jboss-4.2.3, jboss-seam-2.0.2.SP1


            I checked for rich:comboBox but looks like it is not supported by above version...


            Is there a way we can still implementit using current version of seam and jboss.


            Regards
            Vishal

            • 3. Re: Editable dropdown to implement in seam project
              swd847

              The rich:suggestionBox may be sort of what you are after.

              • 4. Re: Editable dropdown to implement in seam project
                valatharv
                Thanks Stuart...

                I will try the option, we need to display the list from database.

                As, it is not available in richfaces 3.1.4.GA, can I directly use "richfaces-*-3.3.1.GA" jars with jboss-4.2.3, jboss-seam-2.0.2.SP1...

                • 5. Re: Editable dropdown to implement in seam project
                  valatharv

                  One more question please...


                  Can't we use rich:comboBox where user can also type and new values inserted in database ?

                  • 6. Re: Editable dropdown to implement in seam project
                    valatharv
                    Hi,

                    I tried to display list of items (from database) in rich:comboBox directly from seam component xxxxList.java.

                    I am getting the whole object in dropdown but need only itemName i.e. ItemA, ItemB, ItemC in combo box

                    I am sure I am doing it wrong and might not be the right way, please suggest.

                    OUTPUT in comboBox:
                    -------------------
                    com.entity.Item@687235[ itemName=ItemA dateCreated=<null> ]
                    com.entity.Item@1223041[ itemName=ItemB dateCreated=<null> ]
                    com.entity.Item@18e0f79[ itemName=ItemC dateCreated=<null> ]

                    XHTML:
                    -----
                    <rich:comboBox defaultLabel="Enter some value"
                         label="#{itemListHome.instance.itemName}"
                         value="#{item.itemName}">                   
                         <s:selectItems id="itemList" value="#{itemList.resultList}"
                                        var="item" label="#{item.itemName}">                        
                         </s:selectItems>                   
                    </rich:comboBox>

                    Entity:
                    -----
                    @Entity(name = "Item")
                    public class Item {
                         protected String itemName;
                         
                         @Basic
                         @Column(name = "ITEM_NAME")
                         public String getItemName() {
                              return itemName;
                         }
                         @Basic
                         @Column(name = "DATE_CREATED")
                         @Temporal(TemporalType.DATE)
                         public Date getDateCreated() {
                              return dateCreated;
                         }
                         ......
                    }


                    Default generated by seam
                    ------------------------
                    @Name("itemList")
                    public class ItemList extends EntityQuery{
                         @Override
                         public String getEjbql() {
                              return "select item from Item item";
                         }
                         ....
                    }