Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

flex dynamic combobox

26 views
Skip to first unread message

Gokulanand

unread,
Jun 16, 2006, 6:15:56 AM6/16/06
to
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","");
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);
}

jwalkup

unread,
Jun 22, 2006, 9:43:42 AM6/22/06
to
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.

0 new messages