Search code examples
apache-flexitemrenderer

Flex Hero spark component - changing view from within custom itemrenderer


I've made a custom list itemRenderer with 2 buttons and a label. One button deletes the list entry (and thats not the problem) the second button would change the actual view. Does anyone knows how I can change actual view within the itemrenderer ?


Solution

  • From what I think I understand, you want to change a viewstack or something. What you want to do is bubble an event from the itemRenderer up to a point in the display list where someone will listen and trigger an event handler which then changes the view.

    So, in your itemRenderer do

    dispatchEvent(new Event('someEventName', true));
    

    And up the display list you need to listen for that even

    this.addEventListener('someEventName', someHandlerFunction);
    

    And in that function just switch your view or whatever else you want.