0 Replies Latest reply on Mar 18, 2008 6:42 AM by paata lominadze

    Populate SelectOnemenu filtered by another one (using a4j)

    paata lominadze Master

      hi all,
      i use seam, richfaces and ajax4jsf frameworks for my application,
      i have simple question.
      i need populate one selectonemenu by another selectonemenu. 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 :
      2.1 DB_VENDOR
      @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
      }
      

      2.2 DB_DRIVER
      @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.beans.entity.jits.DbVendor"/>
       <factory name="dbVendor" value="#{dbVendorHome.instance}"/>
       <framework:entity-query name="dbVendors" ejbql="select v from DbVendor v" />
      ..........
      


      i don't know how i can fill second drop down box, filtered by first.

      any idea will be appreciated.

      ______________
      Regards
      Paata.