2
我使用Marionette.js
來製作應用程序。模型事件不在Marionette中工作
模型事件未觸發如果我在view.initialize
函數中更改Attribute
函數,就像下面的方式一樣。
var ChartsView = Marionette.CompositeView.extend({
initialize:function(){
this.model.set({"currentJson":""},{silent:true});
this.model.set({"currentJson":"test"});
},
modelEvents:{
"change:currentJson":"settingOtherAttributesInSameModel"
},
settingOtherAttributesInSameModel:function(){
console.log("This is Testing");
}
});
雖然實例創建時間,我正在傳遞模型對象就像下面的方式。
chartsViewObj=new ChartsView({el:$('#plannerTablePlace'),model:chartsModelObj});
我不知道,爲什麼model event
不起作用。
我沒有找到,我錯了。
任何人都可以幫助我。
如何解決this.can你解釋清楚。 – user3279058
@ user3279058我已經更新了我的答案。 –