Flex:将参数传递给itemEditor

我有一个datagrid,其中一列调用自定义的itemEditor;
                    <mx:DataGridColumn dataField="city"
                                       width="150" 
                                       headerText="City" 
                                       itemEditor="components.ComboCity" 
                                       editorDataField="city"/>
我的自定义itemEditor看起来像;
    <?xml version="1.0" encoding="utf-8"?>
    <s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                              xmlns:s="library://ns.adobe.com/flex/spark" 
                              xmlns:mx="library://ns.adobe.com/flex/mx" 
                              focusEnabled="true">
        <mx:ComboBox id="comboBox"/>
        <fx:Script>
            <![CDATA[
                public var myString:String;
                .
                .
                .
如何从主应用程序传递一个值到
myString
?     
已邀请:
看看这个链接,我想你会在那里找到答案: http://livedocs.adobe.com/flex/3/html/help.html?content=cellrenderer_3.html Furher xp:
  myGrid.editedItemRenderer.data.City=myEditor(myGrid.itemEditorInstance).setCity.text;
    
对我来说最好的解决方案:
<mx:Script>
    <![CDATA[

        import mx.events.DataGridEvent;

        private function itemEditorCreateHandle(event:DataGridEvent):void
        {               
            ComboCity(DataGrid(event.target).itemEditorInstance).myString = "Put here the value";
        }   

    ]]>
</mx:Script>

<mx:DataGridColumn      
    dataField="city"
    width="150" 
    headerText="City" 
    itemEditor="components.ComboCity" 
    itemEditorCreate="itemEditorCreateHandle(event);" 
    editorDataField="city"/>
    
您始终可以通过调用“outerDocument”属性从itemRenderer引用父组件,例如:
myString = outerDocument.componentProperty
http://livedocs.adobe.com/flex/3/html/help.html?content=cellrenderer_6.html     

要回复问题请先登录注册