Closed asennoussi closed 8 years ago
The idea of afterRender
is that only was execute one time, just after the first render, although I have a couple of concerns about your code, first, the first parameter of Dashing.utils.get
is the name in snake case of your python widget Class, isn't a route, and the following is that the correct way to bind a afterRender function should be like:
myDashboard.addWidget('AvailabilityAverageWidget', 'Graph', {
color: 'steelblue',
scope: {
afterRender: function() {
alert('graph shown');
}
},
getData: function () {
var self = this;
Dashing.utils.get('availability', function(data) {
$.extend(self.data, data);
});
},
interval: 60000
});
I just noticed that part of the documentation is outdated, thanks for making me realize this
myDashboard.addWidget('AvailabilityAverageWidget', 'Graph', { color: 'steelblue', getData: function () { var self = this; Dashing.utils.get('availability/', function(data) { data.afterRender = function() { alert('graph shown'); }; $.extend(self.data, data); }); }, interval: 60000 });
I have only one alert.