Nest view in JS generated view onClick?


I’m wondering how one would go about this or even if it’s doable. I have a “gallery” view which has a list of pictureItemViews. On click of a picture, I want to take the clicked pictureItemView, embed it in a newly created GalleryDetailedView, and put the GalleryDetailedView in place of where the pictureItemView was. However, I have a star rating component in the GalleryDetailedView that I want to bubble up to the pictureItemView.

Here’s a fiddle:

Originally I did the switch out with a general javascript object class at the bottom of the fiddle called ClickBorder. But I couldn’t figure out how to add the StarVoteComponent to the details view and have it bubble up to the pictureItemView instance.

Then I tried to do it with a GalleryDetailView but there seems to be assertion constraints that stops me from appending to the pictureItem’s current dom spot.

Why I don’t start with GalleryDetailsView and embed everything on load? I want to see if I can avoid adding all that fluff and initial processing load.

Any help would be much appreciated. I’m utterly stuck.