django-dashing
django-dashing copied to clipboard
Can't get rv-on-click to work in a custom widget
Hi,
I'm having A LOT of difficulties when trying to add "rv-on-click" to my custom widget.
basically I took the list widget and created my own custom widget with the ability to change the color of the value field. This is how my customlist.js looks:
Dashing.widgets.CustomList = function (dashboard) {
var self = this;
self.__init__ = Dashing.utils.widgetInit(dashboard, 'customlist');
self.row = 2;
self.col = 1;
self.scope = {};
self.getWidget = function () {
return this.__widget__;
};
self.getData = function () {};
self.interval = 10000;
};
rivets.binders['value-color'] = function(el, value) {
if (value == "Down") {
$(el).css('color', 'orange');
}
else if (value == "OK") {
$(el).css('color', 'green');
}
else if (value == "Error" || value == "FAILED") {
$(el).css('color', 'red');
}
};
Now i'm trying to add the following code to the same file ("testbind" is the ID of the customlist div):
var controller = {
popup: function(el) {
alert('test');
}
};
rivets.bind($('#testbind'), {
controller: controller
});
I've tried like a million different variations, went over every example I could find online, but this doesnt seem to work, i keep getting this "this.call is not a function" error.
What am i missing?
Thanks.