我在自定义小部件上传播“更改”事件时遇到问题。这是我的小部件:
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”不起作用。难道我做错了什么?有错误吗?
答案 0 :(得分:0)
在https://github.com/SitePen/dgrid/blob/master/Editor.js#L477中将“this”更改为“cmp”似乎可以解决问题。该问题已在github上发布:https://github.com/SitePen/dgrid/issues/1310