Events Between Marionette.CompositeView And Marionette.ItemView
I have two modules itemView.js and ListView.js. Everything works when I fetch the data. The problem is about the item view (1) when I change the corresponding model. a) the
Solution 1:
I did not work with Marionette but I have been working with Backbone, my thought is that Marionette is not refreshing the template or something like it.
What happens if you try this?
// itemView.js
var itemView = Marionette.ItemView.extend({
initialize: function () {
this.model.on('change', this.render, this);
},
onRender : function(){
//verify your model:
console.log( this.model.toJSON() );
if (this.model.get('closed')) {
this.$el.fadeOut();//bye bye item
}
},
events: {
'click #close': 'closeTask'
},
template: itemTemplate,
tagName: 'li',
closeTask: function () {
if (!this.model.get('closed')) {
this.model.save({
closed: true
});
}
}
});
Post a Comment for "Events Between Marionette.CompositeView And Marionette.ItemView"