1 Reply Latest reply on Aug 13, 2010 1:10 AM by David_F57

    How to call a external function from item renderer?

    hezjing Level 1



      I have a custom item renderer (MXAdvancedDataGridItemRenderer) for a column in AdvancedDataGrid. When the component in the item renderer is clicked, I want to call some functions from the owning component, but how should I get the reference of the owning component?


      One way of doing this is to pass the reference of the owning/parent component when it is creating the item renderer:


        var productRenderer:ClassFactory = new ClassFactory(ProductRenderer);

        productRenderer.properties = { parentRef: this };

        myList.itemRenderer = productRenderer;


      In this case, every item renderer has a copy of the reference and able to the function accordingly.


      Is there a more elegant way of doing this?