Search code examples
javascriptmodel-view-controllerbackbone.jsmodelmarionette

Backbone - merge: true - option not changing UI


I noticed that when I write

collection1.add(model1); --> UI changes fine. However, when I do
collection1.add(model1, {merge: true});
then App.div1.currentView.collection.models shows the changed model (in console) but UI does not change.

I have no clue why?

(Note1: I am using Marionette.js with Backbone)
(Note2: App is the global Marionette object; div1 is a Marionette region in html)


Solution

  • This is what worked with collection1.add(model1, {merge: true}) -

    modelEvents: {
        "change": "render"
    }
    
    // "update": "render" did not work
    

    Added ^^ to Marionette.ItemView which was responsible for model1.