代码之家  ›  专栏  ›  技术社区  ›  Adnan

Flex:将参数传递给itemdeditor

  •  1
  • Adnan  · 技术社区  · 16 年前

    我有一个datagrid,其中一列调用一个自定义项编辑器,比如;

                        <mx:DataGridColumn dataField="city"
                                           width="150" 
                                           headerText="City" 
                                           itemEditor="components.ComboCity" 
                                           editorDataField="city"/>
    

    我的自定义项目编辑器看起来像;

        <?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 ?

    3 回复  |  直到 16 年前
        1
  •  2
  •   ant    16 年前

    看看这个链接,我想你会在那里找到你的答案:

    http://livedocs.adobe.com/flex/3/html/help.html?content=cellrenderer_3.html

    火热经验:

      myGrid.editedItemRenderer.data.City=myEditor(myGrid.itemEditorInstance).setCity.text;
    
        2
  •  1
  •   Jonas Heidelberg liori    14 年前

    <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"/>
    
        3
  •  0
  •   JabbyPanda    16 年前

    通过调用“outerDocument”属性,可以始终从itemRenderer引用父组件,例如:

    myString = outerDocument.componentProperty
    

    http://livedocs.adobe.com/flex/3/html/help.html?content=cellrenderer_6.html

    推荐文章