2009-11-14 134 views
0

在Flex中,如何將ComboBox的selectedItem設置爲grid(name,mobile,category)的selectedItem?如果我在網格(類別)中選擇一行,則必須在類別ComboBox中選擇該選定項目(類別項目)。DataGrid selectedItem與Combox中的selectedItem綁定

<mx:DataGrid id="dg" width="425" height="328" rowCount="5" 
    dataProvider="{contactList}" cornerRadius="3" 
    change="selectedItem=(event.target as DataGrid).selectedItem.groupId;"> 
<mx:ComboBox id="grpName" dataProvider="{groupsList}" labelField="groupName" 
    selectedIndex="{selectedItem}" /> 
+0

+0

這只是可能不在felx – sharvey

回答

2

如果ComboBoxDataGrid的數據提供者是相似的(相同的長度和內容的)可以將selectedIndex屬性綁定到實現這一目標。

<mx:ComboBox selectedIndex="{dg.selectedIndex}"/>