2
votes

I have a spark list control whose data is rendered using an itemrenderer. Basically the Item renderer lays out the data within a Panel.

The Panel has a LinkButton, which when clicked needs to pass an Id to the parent application. In the parent application I have a function that dispatches a custom event to its parent. I want to know how to call this function from the ItemRenderer.

I tried using parentDocument.outerfunction etc but it throws an error..

Any clues ?

5

5 Answers

4
votes

I would have your item renderer dispatch a custom event that contains your Id, making sure that your event bubbles. Then in the parent application listen for that event and call the appropriate function. Hope that helps.

0
votes

If I understand well you can try to call from the item renderer this.parentApplication or this.parent.parent.

0
votes

The best way is to create a custom event and bubble .. and add an event listener for that event in parent document..

0
votes

this is working I have test parentcomponent(this.owner.parent).function...owner is list and parent is the component in which list is placed e-g InvitationList(this.owner.parent).invitationAccepted(persist); type cast the this.owner.parent to your parentclass

-1
votes

If you were using PureMVC, you could send a notification that the receiver would handle and perform the needed work. This is similar to firing a custom event and receiving it in the parent.