In Flex, how can I set the selectedItem of a ComboBox to the selectedItem of a grid (name,mobile,category)? If I select one row in the grid(category), that selected item (category item) must be selected item in categories ComboBox.
<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}" />
Best Answer
If the data provider of the
ComboBox
and theDataGrid
are similar (of same length and contents) you can bind theselectedIndex
property to achieve this.