Parent and events for list in object

Hi all,

I created a short JSBIN to ouline my problem http://jsbin.com/bomulexaho/1/edit?html,js,console,output

What I want to accomplish:

  • For each list entry have a link to the parent object
  • Take some action when the add event for the list is triggered

I tried to use the init of the parent object for this, but the script fails as soon as it runs the lines
this.AS.parent=this;
this.AS.on(“add”, function() {console.log(“Event add”);})

Any suggestions how to resolv this?

I’m not sure that I understand your point but, you need something like this?

example

For the first point, what is for you the “parent” entry?

Thx for making the code work. Helped me to get some more insight.

The parent link is not needed anymore. I realized that each view model assigned to a component gets initiated when rendered. That I somehow missed and wanted to work around with parent links.