2 Replies Latest reply on Apr 22, 2008 3:57 PM by Bachir El Khoury

    How To Pass Data to DataGrid itemEditor

    Bachir El Khoury
      Hi everyone,

      I was wondering if there is any way to pass data to an itemEditor component in a DataGrid?

      say my main app is myApp.mxml:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      private var _dataAlreadyLoaded:Array;
      ]]>
      </mx:Script>
      <mx:DataGrid id="myGrid">
      <mx:columns>
      <mx:DataGridColumn headerText="Column 1" dataField="name"
      editorDataField="newName" itemEditor="myEditor"/>
      </mx:columns>
      </mx:DataGrid>
      </mx:Application>

      my itemEditor is myEditor.mxml:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml" width="400" height="300">
      <mx:Script>
      <![CDATA[
      [Bindable]
      public var _data:Array;
      ]]>
      </mx:Script>
      <mx:ComboBox id="myCmb" dataProvider="{_data}" labelField="name"/>
      </mx:VBox>

      the question is how can i pass
      _dataAlreadyLoaded in myApp to => _data in myEditor

      I can call the server from within myEditor and collect that data, but isn't there an easier more efficient way, to simply pass it through since it's already loaded?

      thanks