为DataGrid提供一个ComboBox类型的ItemRenderer,如下图:

但是在点击ComboBox的时候取不到DataGrid当前的selectedIndex,不能实现需要的功能。

利用下面代码可取得当前项在DataGrid的dataProvider中的索引。

 

 
  
  1. var itemIndex:int = ArrayCollection((owner as DataGrid).dataProvider).getItemIndex(_ownerData);