AutoRendering view in Marionette.Region when changing collection/model

1,702 views
Skip to first unread message

Ruslan Korolev

unread,
Feb 6, 2014, 10:37:04 AM2/6/14
to backbone-...@googlegroups.com
Hi all, For example i have Some layout with Main region with Collection view in it region.
How to rerender automatically collection view when collection is changes?
If i do this without region everything is fine , or i must manually reRender WHOLE region like this: 
Region.show new Collection View ...

Dustin Nation

unread,
Feb 6, 2014, 4:36:52 PM2/6/14
to backbone-...@googlegroups.com
According to https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.collectionview.md#collectionview-automatic-rendering 
it *should* just work.  However, I've  run into some similar situations where it doesn't.

Try adding the following line into your collection view's initialize function:
this.collection.on("all", this.render);

That should bind all events in the collection to the view's render function which will keep you from having to rerender the entire region.

Cheers.
Reply all
Reply to author
Forward
0 new messages