The common pattern in Backbone/Spine is to re-render the whole view from scratch when something happens.
But what do you do if you only need to update a small part of it (highlight, select, disable, animate etc)?
It doesn't make any sense to re-render everything as it might screw up the current layout (If the page has been scrolled to a certain point for example).
On the other hand if you update small parts "inline" from the View using something like $('.selected').highlight()
, then you would have to duplicate the same logic in the view template and JavaScript code.
So what is the "best practice" in Backbone/Spine to do that?
In Spine, use the element pattern: http://spinejs.com/docs/controller_patterns
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With