dojodgrid

dgrid: Issue when propagating change from custom Widget


I'm having trouble with propagating a "change" event on a custom widget. This is my widget:

define([
"dojo/_base/declare",
"dijit/_Widget",
"dijit/_TemplatedMixin",
"dojo/on",
"dojo/text!./TopEditor.html",
], function (declare, _Widget, _TemplateMixin, on, domClass, template) {
    return declare("myEditor", [_Widget, _TemplateMixin], {
        templateString: template,
        value: false,
        _onClick: function (event) {
            this.set("value", !this.get('value'));
            this.emit("change");
        },
        _setValueAttr: function (value) {
            this.value = value;
           // ... do some dom stuff ...
        }
    });
});

Problem is, that in Line 477 of Editor.js (https://github.com/SitePen/dgrid/blob/master/Editor.js#L477) "this" is given to the _updatePropertyFromEditor method, while "this" in my context is the domNode of the widget and not the widget itself and then propagating of "dgrid-datachange" does not work. Am I doing something wrong? Is there a bug?


Solution

  • Changing "this" to "cmp" in https://github.com/SitePen/dgrid/blob/master/Editor.js#L477 seems to fix the Problem. The issue is posted already on github: https://github.com/SitePen/dgrid/issues/1310