每当dijit select中的选择发生变化时,我都会显示一个dijit对话框。问题是我得到一个“未捕获范围错误:在dijit select中进行另一个选择之前,如果没有手动关闭对话框(单击对话框右上角的X),则会出现“超出最大调用堆栈”。我尝试在使用.show()方法之前使用.hide()方法隐藏对话框--但我仍然得到相同的错误。有什么方法可以防止此错误吗?
//选择模板:
<div>
<br /><select name="selectMAS" style="width: 150px; height:20px;"
data-dojo-type="dijit/form/Select" data-dojo-attach-point="selectMAS"
data-dojo-attach-event="onChange:MASChange"></select>
</div>
//从select打开对话框的代码:
MASChange: function (evt) {
//show the dialog when the selection changes (content of the dialog changes with the selection)
NSRF.NSRFDialog.show();//NSRF created in postcreate of class
}
//对话框模板:
<div>
<div data-dojo-type="dijit/Dialog" title="New Service Request Form" data-dojo-attach-point="NSRFDialog" class="nonModal">
TEST
</div>
</div>
//对话框代码:
define([
"dojo/_base/declare",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dijit/_WidgetsInTemplateMixin",
"dojo/dom", "dojo/ready", "dojo/dom-style", "dojo/on",
"dojo/text!Templates/test.htm"
], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin,
dom, ready, style, on,
NSRFTpl) {
return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
templateString: NSRFTpl,
postCreate: function () {
},
destroy: function () {
this.inherited(arguments);
},
showForm: function () {
//fill in some info in the form later
},
});
});
谢谢
查看调用堆栈,发现错误:Select.js
try {
this.focusNode.focus()
} catch (a) {}
}, focusChild: function(a) {
a && this.set("value", a.option)
}, _getFirst: function() {
var a = this._getChildren();
return a.length ? a[0] : null
}, _getLast: function() {
var a =
型
init.js
try {
a.focus()
} catch (c) {}
}
}));
b(function() {
var a = v.registerWin(r.get(document));
c("ie") && d(window, "unload", function() {
a && (a.remove(), a = null)
})
});
s.focus = function(a) {
v.focus(a)
};
for (var w in v) /^_/.test(w) || (s.focus[w] = "function" == typeof v[w] ? g.hitch(v, w) : v[w]);
v.watch(function(a, c, b) {
s.focus[a] = b
});
return v
})
}, "dijit/hccss": function() {
define(["dojo/dom-class",
1条答案
按热度按时间64jmpszr1#
我在对话框中有一个EnhancedGrid,但遇到了相同的错误:RangeError“超出了最大调用堆栈大小”。将对话框的“autofocus”属性设置为false可解决此问题。