i really don't know how to implement the Isotope plugin when using Backbone Marionette Views. Actually i'm doing this in my CompositeView:
class List.PostsView extends App.Views.CompositeView
template: "#template"
itemView: List.PostView
appendHtml: (collectionView, itemView, index) ->
$newItems = $(itemView.el)
#console.log "newItems", $newItems
$.getScript "//cdn.jsdelivr.net/isotope/1.5.25/jquery.isotope.min.js", ->
$("#postsRegion").imagesLoaded ->
$("#postsRegion").isotope
itemSelector: ".item"
$("#postsRegion").isotope "insert", $newItems
This means, i overwrite the default method of Marionette for appending the itemView (childView).
It is working but i don't think it is the right way, this should be very slow because the Isotope plugin has to be initialized for every model again? I tried to initialize Isotope outside the View but that didn't worked even if #postsRegion is outside of the CompositeView template.
I need this in combination with the Marionette Views because every new model added to the collection should be rendered automatically. Also the ItemView gives me the template which should be appended in the DOM. (the template is a Bootstrap 3.0 Thumbnail - col-md-4)
I would be very grateful if someone could help me in this matter.
Marcel