【问题标题】:ReferenceError: template is not definedReferenceError:模板未定义
【发布时间】:2019-08-26 21:36:56
【问题描述】:

我正在开发一个 ICN(3.0.4) 插件,我在其中创建了一个名为“SampleAction”的 PluginAction。单击此按钮后,我想打开一个对话框并显示一些选项供用户选择。从服务 js 中,我正在调用另一个模板化小部件,我在其中创建对话框。调用此小部件时,出现“ReferenceError:未定义模板”错误。下面是模板化小部件的代码sn-p

******************JS******************

define([
    "dojo",
    "dijit",
    "dojo/_base/declare",
    "dojo/_base/lang",
    "dijit/form/FilteringSelect",
    "dijit/form/Button",
    "dojo/store/Memory",
    "dojo/query",
    "dojo/on",
    "dojo/aspect",
    "dojo/dom-construct",
    "dojo/dom",
    "dijit/registry",
    "dojo/dom-attr",
    "ecm/model/Request",
    "ecm/model/Desktop",
    "dojo/ready",
    "dojo/NodeList-traverse",
    "dijit/ConfirmDialog",
    "dijit/_TemplatedMixin",
    "dijit/_WidgetsInTemplateMixin",
    "dojo/text!./templates/SendDocsToCustomerScreen.html"
    ],
    function(dojo, dijit, declare, lang, FilteringSelect, Button, Memory, query, on, aspect, domConstruct, dom, registry, attr, Request, Desktop, ready,test,ConfirmDialog,
            _TemplatedMixin,_WidgetsInTemplateMixin,template) {

    return declare("iCNCommonServiceDojo.SendDocsToCustomerImpl", [ _TemplatedMixin, _WidgetsInTemplateMixin], {

        **contentString: template,**
        widgetsInTemplate: true,
        showDialogBox: function(repository, items, callback, teamspace, resultSet, parameterMap){
            var confirmDialog = new ConfirmDialog({
                title: "Send Documents to Customer",
                content: "Test content.",
                style: "width: 40%;height:100%;",
                buttonOk:"Send",
                buttonCancel:"Cancel"
            },"sendDocsToCustomerDialog");
            confirmDialog.set('content',this.dialogContent);
            confirmDialog.refresh();
            confirmDialog.show();
        } 

    });
});

***************HTML*********************

<div id="sendDocsToCustomer">
    <div id="sendDocsToCustomerDialog"></div>
    <div data-dojo-type="dojox.layout.TableContainer"
        data-dojo-attach-point="**dialogContent**">
            <div data-dojo-type="ecm.widget.RadioButton" data-dojo-attach-point="email" data-dojo-props="lable:'Email'"></div>
            <div data-dojo-type="ecm.widget.RadioButton" data-dojo-attach-point="fax" data-dojo-props="lable:'Fax'"></div>
        </div>
</div>
</div>

当我调试并寻找价值时

contentString: template

我看到错误消息。加载插件后,我在控制台中看不到任何错误。

【问题讨论】:

  • 创建构造方法然后尝试控制台日志(模板)似乎你有错误的 url (./templates/SendDocsToCustomerScreen.html)

标签: dojo filenet-p8 filenet ibm-content-navigator


【解决方案1】:

您使用的是 contentString 而不是 templateString; ContentString(如果我没记错的话)用于填充对话框。

所以

 templateString: template,

另请参考:https://dojotoolkit.org/reference-guide/1.10/dijit/_TemplatedMixin.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-06
    • 2013-05-26
    • 2012-08-24
    • 2019-10-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多