1
var resultItemView = Marionette.CompositeView.extend({
render : function(){
google.load("visualization", "1", {packages:["table"], callback: function() {
var self = this;
this._drawVisualization(self);
}});
},
_drawVisualization : function(self){
var data = new google.visualization.DataTable();
//Here i'm creating data table ...
var chart = new google.visualization.LineChart(self.$el.find("#graphDiv"));
chart.draw(data, null, null);
},
return resultItemView;
});
在渲染函數中,正在加載google可視化並在回調函數中調用drawVisualization。另外,我將「this」對象作爲參數傳遞給此函數。爲此,我使用了匿名函數。在drawVisualization函數中,self等於這個「this」對象。但是我得到這個錯誤:「Uncaught TypeError:Object [object global] has no method'_drawVisualization'」。我究竟做錯了什麼?我如何糾正它?感謝幫助。Uncaught TypeError:Object [object global]沒有方法