附加点仅在第一次显示对话框时起作用

时间:2013-03-06 03:43:15

标签: templates dialog dojo

我正在扩展dijit.Dialog并添加模板:

define([
    "dojo/_base/declare",
    "dijit/Dialog",
    "dijit/_TemplatedMixin",
    "dijit/_WidgetsInTemplateMixin",
    "dojo/data/ItemFileWriteStore",
    "dojo/text!ps/templates/PrintDialog.html",
    "dijit/form/ComboBox",
    "dijit/form/Button",
    "dojox/widget/Standby",
    "dojox/layout/TableContainer",
    "dijit/form/CheckBox"
], function (declare, Dialog, TemplatedMixin, _WidgetsInTemplateMixin, ItemFileWriteStore, template) {

    return declare("ps.PrintDialog", [Dialog, TemplatedMixin, _WidgetsInTemplateMixin], {
        templateString: template,
    widgetsInTemplate: true,

在我的模板中:

< 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未定义,代码失败。

1 个答案:

答案 0 :(得分:0)

是否存在“尝试注册具有相同ID的小部件”的问题/错误。如果有人请从两个选择标记中删除id。