views:

60

answers:

2

how do i change the item selected in a combobox selection based on a selection of a datagrid object?

A: 

Just bind the selectedItem property of the combobox to the dataGrid:

<s:ComboBox
  id="combo"
  dataProvider="{data}"
  selectedItem="{dg.selectedItem}" />

<mx:DataGrid
    id="dg"
    dataProvider="{data}"/>
Treur
but i want only a paricular feild from the datagrid to be selected
ruchir patwa
I don't quite understand. Perhaps you could provide a more elaborate description of your use-case?
Treur
selectedItem = "{dg.selectedItem['particularField']}"
Richard Haven
A: 

use the itemClick event on the datagrid to change the selection of the combo box. You can find similar answer here http://stackoverflow.com/questions/972334/itemclick-event-in-datagrid

redben
it works for a text field but can you tell me how to implement it in a combo box?pls
ruchir patwa
I'd recommend using ListEvent.CHANGE event instead. ItemClick doesn't cover all methods of selection on the DataGrid/List, since the user can change selection via Keyboard.
bug-a-lot
bug-a-lot is right ListEvent.CHANGE is the best way to do it.
redben