2
我有一個模型,如:如何通知從模型視圖更改值在骨幹
var resultEntityModel = Backbone.RelationalModel.extend({
defaults : {
name : "",
bgOccurence : "",
fgOccurence : "",
bgOccurenceCount : "",
fgOccurenceCount : "",
},
initialize : function() {
var bgOccurence = this.set("bgOccurence", bgOccurence);
var fgOccurence = this.set("fgOccurence", fgOccurence);
if((Math.abs((bgOccurence-fgOccurence))) >= 10){
// send information to view that background should be red
}else{
// send information to view that background should be white
}
},
});
和一個視圖:
var resultEntityView = Marionette.CompositeView.extend({
tagName : "tr",
template : ResultEntityPanel,
initialize: function() {
this.model.on(...) // it should take information from model
//and change css values according to this information
},
});
我如何可以從模型的信息,並將其發送查看以便更改.css文件中的某些值?我知道這個方法,但我不知道該怎麼做。
'this.model.on( '變',函數() {console.log(「hidyho」);});' - 但是對於更改.css文件這將是一個不行,您可以使用jQuery來更改某些東西的CSS。 –