How To Pass Data to DataGrid itemEditor

Avatar

Avatar

Bachir_El_Khour

Avatar

Bachir_El_Khour

Bachir_El_Khour

15-04-2008

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

Replies

Avatar

Avatar

riesvantwisk

Avatar

riesvantwisk

riesvantwisk

22-04-2008

Avatar

Avatar

Bachir_El_Khour

Avatar

Bachir_El_Khour

Bachir_El_Khour

22-04-2008

Thanks Ries,

I bumped to this link but didn't help me before.



the problem was solved through a custom event I fired when
the itemEditor component has been complete, then passed my data
through event.target



didn't think about it for some reason, until someone pointed
it out for me.



All good now thx Ries