Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get rv-on-click to work in a custom widget #77

Open
EB123 opened this issue Apr 12, 2017 · 0 comments
Open

Can't get rv-on-click to work in a custom widget #77

EB123 opened this issue Apr 12, 2017 · 0 comments

Comments

@EB123
Copy link

EB123 commented Apr 12, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant