我正在扩展 dijit.Dialog 并添加一个模板:
定义([ "dojo/_base/declare", "dijit/对话", "dijit/_TemplatedMixin", "dijit/_WidgetsInTemplateMixin", "道场/数据/ItemFileWriteStore", "dojo/text!ps/templates/PrintDialog.html", "dijit/form/ComboBox", "dijit/表单/按钮", "dojox/widget/待机", "dojox/布局/TableContainer", “dijit/表单/复选框” ]、函数(声明、对话框、TemplatedMixin、_WidgetsInTemplateMixin、ItemFileWriteStore、模板){ return declare("ps.PrintDialog", [Dialog, TemplatedMixin, _WidgetsInTemplateMixin], { 模板字符串:模板, 小部件InTemplate:真,
在我的模板中:
< select data-dojo-type="dijit.form.ComboBox" id="format" name="format" data-dojo-attach-point="formatCombo" title="Format" >
< select data-dojo-type="dijit.form.ComboBox" id="layout" name="layout" data-dojo-attach-point="layoutCombo" title="Layout" >
这是附加点的用法:
this.formatCombo.attr('store', this.formatStore); this.layoutCombo.attr('store', this.layoutStore);
现在,我第一次创建一个新对话框时,它工作正常。如果我随后关闭对话框并创建一个新对话框,则 this.formatCombo 和 this.layoutCombo 未定义,代码将失败。