如何访问AdvancedDataGrid组合框值

时间:2012-09-13 07:23:52

标签: flex combobox advanceddatagrid

我尝试访问AdvancedDataGrid - AdvancedDataGridColumn值?它的ComboBox和我使用此代码访问:

'"+ myGrid_olculer.dataProvider[k].data + "'

然后结果是:

INSERT INTO [INN_T_OPTSIPARIS]  ( GAIN) values (' [object Object]'  ) 

对于组合框,我使用它:

<mx:AdvancedDataGridColumn headerText="GAIN"    dataField="GAIN"    editable="true"   rendererIsEditor="true" editorDataField="data">
<mx:itemRenderer>
<mx:Component>
<mx:ComboBox creationComplete="GAIN_init()">
<mx:Script>
<![CDATA[
private var _data:Object;
[Bindable]
override public function set data(o:Object):void {
_data = o;
if(Number(o.GAIN) <= 0) {
  this.selectedIndex = 0;}
else {this.selectedIndex = Number(o.GAIN);}
}
override public function get data():Object {return _data;}
private function GAIN_init():void {
                                            this.dataProvider = ["Evet", "Hayır"];
                                            this.addEventListener(MouseEvent.CLICK, update);}
private function update(event:MouseEvent):void {if(this.selectedIndex == 0) _data.GAIN = "-1";                                                 else _data.GAIN = this.selectedIndex.toString();}
]]>
</mx:Script>
</mx:ComboBox>
</mx:Component>
</mx:itemRenderer>
</mx:AdvancedDataGridColumn>

1 个答案:

答案 0 :(得分:0)

将chnage事件放在组合框上并将新选择的值设置为

data.GAIN = combox.selectedLabel

现在可以访问的最新值

data.GAIN或dataprovider Oject.root标签[rowindex] .GAIN