SitePen / dgrid

A lightweight, mobile-ready, data-driven, modular grid widget designed for use with dstore
http://dgrid.io/
Other
628 stars 295 forks source link

Issue when propagating change from custom Widget #1310

Closed scyv closed 4 years ago

scyv commented 8 years ago

Hello,

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 . Changing "this" to "cmp" fixes the Problem. Am I doing something wrong? Is this a bug?

See here for the "fix": https://github.com/scyv/dgrid/commit/3536a966bf45fc9178718e8fef882014dd50a782

msssk commented 4 years ago

Fixed in #1405