It depends how you design your renderer. Ben's example is excelent and will
show you how to implement an item renderer fully decoupled. In case you have an
in-line renderer, you can use outerDocument.
Example
var myVar : String = Global var declared somewhere in your parent
application. and
from your renderer you can access it: outerDocument.myVar
HTH,
Valy
- Original Message
From: ben.clinkinbeard [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, December 5, 2006 11:30:08 PM
Subject: [flexcoders] Re: itemrenderer trying to access variables in main
application
Hi Bill,
This is pretty simple to accomplish if you use ClassFactory to set up
your itemRenderers. You'll need to implement IFactory in your
itemRenderer class and then do something like this in the file where
your DataGrid lives:
[Bindable] private var myRenderer:ClassFac tory;
myRenderer = new ClassFactory( MyAwesomeRendere rClass);
myRenderer.properti es = {externalObject: mainApp,
externalPropertyNam e: buttonTwoEnabled };
Then inside your IR class (where you've also declared public vars with
the same names as in the properties object) you could bind the
button's enabled property to externalObject[ externalProperty Name].
This technique is explained in more detail here:
http://www.returnun defined.com/ 2006/11/creating -truly-reusable- renderers-
with-classfactor y/
HTH,
Ben
--- In [EMAIL PROTECTED] ups.com, bghoward3 billhoward@ ... wrote:
can someone point me in the right direction of retrieving a binded
vriable created in the main application from a itemrenderer located in
a datagrid?
i have a datagrid that contains an itemrender, the itemrender file
contains 2 buttons. based on the user id which is established in the
main application, one of these buttons may or may not be enabled
i have tried outerdocument and various iterations of parent
application and mx.core with no success
thanks in advance for any leads
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com