How to pass data to a component that is used as an itemRenderer

Posted on 2009-04-21
Last Modified: 2012-05-06
I have a component, and when used in the normal sense, passing data to it is not a problem. Let's say I have a component called MyComponent which has one public property called dp (for dataProvider). When using this component normally, passing data to it is easy:

<v:MyComponent dp="{some array collection}"/>

 But I now want to use this component as an itemRenderer in a datagrid. Since an item renderer is defined like:

<mx:DataGridColumn itemRenderer="MyComponent"/>

I'm not sure how to pass data to it anymore.

I also want to keep this component loosely-coupled, meaning I don't want to use mx.core.Application.application from within the component to access data outside it.

Does anyone know how I can pass data to a component being used as an itemRenderer and still keep it loosely-coupled?

Question by:elepil
    LVL 37

    Accepted Solution

    var myRenderer:ClassFactory = new ClassFactory(MyComponent); = { dp: yourArrayCollection };
    myDataGrid.itemRenderer = myRenderer;


    Author Closing Comment

    I rated your answer "Partially", only because it took me a few moments to figure out the context, but the answer is definitely accurate, and the link to the Adobe's livedocs makes it complete. Thank you.
    LVL 37

    Expert Comment

    Thanx 4 axxepting

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Suggested Solutions

    First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now