dojo dgrid:从自定义小部件传播更改时出现问题

a5g8bdjr  于 2022-12-16  发布在  Dojo
关注(0)|答案(1)|浏览(182)

我在自定义小部件上传播“更改”事件时遇到问题。这是我的小部件:

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 ...
        }
    });
});

问题是,在Editor.js(https://github.com/SitePen/dgrid/blob/master/Editor.js#L477)的第477行中,“this”被赋予_updatePropertyFromEditor方法,而在我的上下文中,“this”是小部件的domNode,而不是小部件本身,然后**“dgrid-datachange”的传播不起作用**。我做错了什么吗?有bug吗?

waxmsbnn

waxmsbnn1#

在www.example.com中将“this”更改为“cmp”https://github.com/SitePen/dgrid/blob/master/Editor.js#L477似乎可以修复此问题。此问题已发布在github上:https://github.com/SitePen/dgrid/issues/1310

相关问题