次のようなモデルがあります。
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 ファイルの値を変更するために、モデルから情報を取得してビューに送信するにはどうすればよいですか? 方法は知っているのですが、やり方がわかりません。