Groups > Multimedia > Macromedia rich int apps > Re: flex dynamic combobox




flex dynamic combobox

flex dynamic combobox
Fri, 16 Jun 2006 10:15:56 +000
Hi

 in my application i want to create a dynamic combobox data loader 

 that i have done successfully, but the prob is i am unable to get the 
selectedItem value from combobox 

 i wanted to do that 

 can anybody suggest me for that or else send me source code 

 MY codings

 Dynamiccombo.mxml

 <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" 
verticalGap="20" initialize="calling()" >
    <mx:HTTPService id="employeeSrv"
serviceName="SampleEmployeeSrv">
       <mx:request>
          <deptId>{dept.selectedItem.Name}</deptId>
        </mx:request>
    </mx:HTTPService>
  <mx:Script>
    <![CDATA[
    function calling()
 	{
 	employeeSrv.send();
 	}
     ]]></mx:Script>
         <mx:Label text="Select a department:"/>
         <mx:ComboBox id="dept" width="150" 
dataProvider="{employeeSrv.result.employees.test}">
              </mx:ComboBox>
    <mx:Button label="Get Employee List"
click="employeeSrv.send();"/>
 </mx:Application>

 employee.jsp

 String sql = "select distinct(name) from dct_test";
 try
 {
 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
 Connection
conn=DriverManager.getConnection("jdbc:odbc:mydsn","sa",&quo
t;");
 Statement st = conn.createStatement();
 ResultSet rs = st.executeQuery(sql);
 while(rs.next()){
 String res = rs.getString(1);
 System.out.println(res);
 %><test><%=res%></test><%
 }
 if(rs != null)rs.close();
 if(st!=null)st.close();
 if(conn!=null)conn.close();
 }
 catch (Exception e)
 {
 System.out.println("ERROR : " + e);
 }


Post Reply
Re: flex dynamic combobox
Thu, 22 Jun 2006 13:43:42 +000
For Flex 1.5, I once succeeded with this technique:
     employeeSrv.result.employees.test[ dept.selectedIndex ]
 or, in general,
     myDataProvider[ myComboBox.selectedIndex ] .
 Behaviour of dept.selectedItem seems inconsistent.
Post Reply
about | contact