I would like to re-render a list made using Marionette.ItemView
when the corresponding model in ItemView change.
Any idea about the best way to active this task?
// Collection passed to Marionette.CompositeView
myCollection.attributes = [
{
id: 1,
name: 'bar'
closed: false
},
….
];
// Marionette.ItemView
myModel.set({
closed: true
}); // when this model change I would like to re-render the copositeView
// or remove the Marionette.ItemView
P.S:
If I try the following code(1) in Marionette.ItemView,
when I save the model, I get the following error(2).
(1)
// Marionette.ItemView
initialize: function () {
this.model.on('change', this.render);
}
(2)
Uncaught TypeError: Object [object Object] has no method 'serializeData'
Is a good practice to use the _.bindAll in your initialize method. May be your issue is related to the scope.
If bindAll does not fix your issue please paste your Model and View.