I’m new to backbone and am a bit stuck. Basically I want to update a collection on the change of a select. Currently on the change of the select I call Collection.fetch() but this appends the new models in the view. I was under the impression that when fetch is called, it removes the previous models which should then cause the related views to be removed, or am I incorrect?
Any help is appreciated!
It does by default, unless you’ve specified
{add: true}.The reason that the elements are being appended in the view will be because you are appending them without clearing out the old. When the
resetevent is fired in your view you could consider emptying your container before appending.Remember, with backbone you are handling the DOM manipulation yourself. The View is not automagically updated along with your Collections & Models.