In our project we are using Ractive together with Backbone. Backbone.View has a "setElement" method, that basically sets the el property of a Backbone.View, thus allowing to attach the View to a different element of the DOM. I was wondering if there is a similar functionality for a Ractive object. Simply changing the el property of a Ractive object doesn't do the trick.
var oRactive = new Ractive(
{
"data": someData,
"el": someDomElement,
"template": someTemplate
});
// ... after doing some other stuff we'd like to set oRactive do a different el
// this.doesn't do the trick
oRactive.el = someOtherDomElement;
// this puts the renderedHTML in our DOM element but binding doesn't work
$(someOtherDomElement).html(oRactive.renderedHTML());
I'm not really surprised that the above doesn't work. Question is: Is there a way to make it work or is it generally impossible?
I am aware that I could just append oRactive.el to "someOtherDomElement" but that's not quite what I want.