You can access the instance members of your surrounding document using a
special property *outerDocument*  from within the mx:Component tag when
using inline renderers.
<mx:Component>
  <mx:ComboBox dataModel="{outerDocument.choices}"/>
</mx:Component>

outerDocument allows you to access any special data or functions you've
defined outside the mx:Component.  It works nicely when you need to inject
data/behavior that is not associated with the data field from the model.
 Remember itemRenders/editors are unique per row so there's no way to inject
data into them since you're not in control of constructing them.  This is
the only way I've found around this little snafu.

If you don't use inline components you can always wrap your custom component
inside an inline and pass data form the outerDocument in as properties to
your custom component thus keeping the code nice and straight forward.  No
tricky code.

Charlie

On Wed, Feb 25, 2009 at 1:36 PM, Tyler Kocheran <[email protected]> wrote:

>   Does anyone know how to do this? I'm really confused on this one, and I
> honestly need some help. I resorted to using a static variable to get the
> data to where it needs to be, but I just can't make it work. Here's some
> more info.
>
> I'm creating an editable DataGrid for the purpose of associating Interest
> objects with a User object. The Interest object has a realm property which
> references the id of a Realm object which I've created. I need to basically
> create these Interest objects on what the user has input in each DataGrid
> row. As one of my editors, I need a ComboBox which will reference the Realm
> objects and use each Realm's "name" property for a label, and each Realm's
> "id" property for a data field, because I ultimately need to pull that info
> into Interest objects which use a Realm's "id" property as their own "realm"
> properties.
>
> Basically, I just need to supply a list of Realm objects to my itemeditor
> ComboBox. This is seeming pretty impossible to me at the moment,
> unfortunately.
>
> On Tue, Feb 24, 2009 at 6:11 PM, Tyler Kocheran <[email protected]>wrote:
>
>> I need to pass in data to one of my item editors for a data grid column. I
>> have an array of data objects that are loaded at runtime and I need to pass
>> that collection to item editors so they can use it as a data provider.
>> Here's an example of what I need to do. I'm loading a bunch of "TKImage"
>> objects which define a few properties like "name" and "id". I need to use
>> the "id" property as each individual item's data field, and apply the name
>> as each individual item's label field. I know it's possible to do something
>> like this statically at compile time with a nested <mx:dataProvider> tag and
>> I know it's also possible to use a static property to pass the data along,
>> but I'm trying to avoid those two things because my application has the need
>> to be dynamic, and I don't like global variables too much ;)
>>
>>  What I need is for something like this to function:
>> <mx:DataGrid editable="true">
>>     <mx:columns>
>>           <mx:DataGridColumn>
>>                <mx:Component>
>>                        <mx:ComboBox dataProvider="{myDataProvider}"/>
>>                </mx:Component>
>>           </mx:DataGridColumn>
>>     </mx:columns>
>> </mx:DataGrid>
>>
>> --
>> And do this, knowing the time, that now it is high time to awake out of
>> sleep;
>> for now our salvation is nearer than when we first believed.
>>
>
>
>
> --
> And do this, knowing the time, that now it is high time to awake out of
> sleep;
> for now our salvation is nearer than when we first believed.
>
>  
>

Reply via email to