11 Replies Latest reply on Dec 13, 2008 4:26 PM by Raghunath Nandy

    Fill SelectOnemenu filtered by another one (using a4j)

    Paata Lominadze Newbie

      hi all,
      i use seam, richfaces and ajax4jsf frameworks for my application,
      i have simple question.


      i need populate one selectonemenu - A filtered by another selectonemenu - B . how i can do it ?


      here is my code snippets :


      1.view


      <h:selectOneMenu id="dbType" styleClass="LoginLangCombo" value="#{dbparams.dbVendor}">                        
                              <s:selectItems value="#{dbVendors.resultList}" var="vendor" label="#{vendor.dbvendorname}" noSelectionLabel="Please Select DataBase ... "/>
                              <s:convertEntity />
                              <a4j:support event="onchange" reRender="dbDriverid" />
                          </h:selectOneMenu>
      .............
      
      <h:selectOneMenu id="dbDriverid" styleClass="LoginLangCombo" value="#{dbparams.dbDriver}">                        
                              <s:selectItems value="#{dbDrivers.resultList}" var="driver" label="#{driver.drivername}" noSelectionLabel="Please Select DataBase ... "/>
                              <s:convertEntity />
                          </h:selectOneMenu>
      


      how i can filter second component by first ?
      here is my entities



      @Entity
      @Table(name = "DB_VENDOR",schema="JITS")
      public class DbVendor implements Serializable {
      private static final long serialVersionUID = 1L;
      private BigDecimal id;
      private String dbvendorname;
      private Collection<DbDriver> dbDrivers;
      // .... setters and getters
      }
      


      and


      @Entity
      @Table(name = "DB_DRIVER",schema="JITS")
      public class DbDriver implements Serializable {
      private static final long serialVersionUID = 1L;
      private BigDecimal id;
      private String dbdrivername;
      private DbVendor vendor;
      // .... setters and getters
      }
      


      and my components.xml looks like :


      <framework:entity-home name="dbVendorHome" entity-class="com.magticom.billing.jbossmonitor.beans.entity.jits.DbVendor"/>
         <factory name="dbVendor" value="#{dbVendorHome.instance}"/>
         <framework:entity-query name="dbVendors" ejbql="select v from DbVendor v" />
         
         <framework:entity-home name="dbDriverHome" entity-class="com.magticom.billing.jbossmonitor.beans.entity.jits.DbDriver"/>
         <factory name="dbDriver" value="#{dbDriverHome.instance}"/>
         <framework:entity-query name="dbDrivers" ejbql="select v from DbDriver v where v.dbVendorId = #{dbparams.dbVendor} " />
      
      



      what is incorrect into my example ?
      is there any example about it ?


      i saw seam production example, they did what i need :
      http://www.partsallover.com.au/home.seam?cid=71128



      any idea will be appreciated.


      Regards


      Paata.