AnsweredAssumed Answered

Rendering subview , appending template to element

Question asked by Caim Astraea on Dec 22, 2015
Latest reply on Dec 23, 2015 by Caim Astraea

Hello o/

 

I'm trying to append a subview to a specific dom element.

 

Following Matt's example where he appended/prepended a custom template to the parent record view I'm trying to append / prepend mine to the this.$el.find('[data-name="schdinfo_c"]')

which is a field , inside a tabbed panel that stores the info from the form.

 

However doing it as this.$el.find('[data-name="schdinfo_c"]').prepend(formH()); or this.$el.find('[data-name="schdinfo_c"]').append(formH())results in the subview being rendered multiple times , I think at least 2 times. The only way it worked was to replace the element with .html() or .replaceWith() which is something would like to avoid.

 

Would it work with this.setElement(template); ? Anyone more experienced with this can kindly provide an example ?

Here's how it looks like trying to append the view.

append.pngprepend.pnghtml.png

Outcomes