我想重新渲染一個使用Marionette.ItemView
的對應模型時ItemView
發生更改。綁定到ItemView的更改事件
有關啓動此任務的最佳方式的任何想法?
// 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:
如果我嘗試在Marionette.ItemView
,
下面的代碼(1)當我保存模型,我得到以下錯誤(2)。
(1)
// Marionette.ItemView
initialize: function() {
this.model.on('change', this.render);
}
(2)
Uncaught TypeError: Object [object Object] has no method 'serializeData'
我還沒有使用Marionette,但您需要綁定到視圖中的模型更改事件,以便該視圖可以理解重新呈現自身。 – jamcoupe
我確實試圖在製片廠製作。ItemView,但我得到以下錯誤'未捕獲TypeError:對象[對象對象]沒有方法'serializeData'' –