Skip to content

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

Open
@EB123

Description

@EB123

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions