This is not a question regarding nested Views, I have read tutorials on this but they don't seem to apply to my problem.
So: I have a Backbone View that in its render()
method creates a totally new and independent element via an external npm module. This not ideal but faster than to rewrite it myself. Within render()
and after instantiating the new element I call this.setElement
to bind the View to the newly created element. So far so good, this.$el
is correctly updated.
But I have defined an events
map, whose event handlers don't get moved to the new $el
. Why is that? What am I doing wrong?
Ich have created a simplified gist: https://gist.github.com/4nduril/dab571e876b215e3786f
EDIT: I have edited the fiddle of James Akwuh to one resembling my code: https://jsfiddle.net/ztwz3e3o/ You can see, I am calling the render method in an event listener. This fiddle works apparently. So I have still no idea why my own code doesn't.
I'll keep digging.