我在自定义小部件上传播“更改”事件时遇到问题。这是我的小部件:
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吗?
1条答案
按热度按时间waxmsbnn1#
在www.example.com中将“this”更改为“cmp”https://github.com/SitePen/dgrid/blob/master/Editor.js#L477似乎可以修复此问题。此问题已发布在github上:https://github.com/SitePen/dgrid/issues/1310