我正在创建一个新的dijit并在同一个html文件中我用标记声明它但我从mixin #5 is not a callable constructor
文件获取dojo.js
,请看下面的代码片段并帮我弄清楚是什么我在代码中遗漏了,非常感谢提前:
注意:当我使用define()而不是require()时,它不是渲染模板。
dijit创建代码:
require([
"dojo/_base/declare",
"dojo/parser",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dijit/_WidgetsInTemplateMixin",
"ecm/widget/viewer/FilenetViewer",
"ecm/widget/dialog/ErrorDialog",
"ecm/model/Desktop",
"ecm/model/Repository",
"ecm/model/Request",
"dojo/ready",
"dojo/text!./templates/DocumentViewerWidgetv0.003.html"
], function(declare, parser, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, FilenetViewer, ErrorDialog, Desktop, Repository, Request, ready, template) {
declare("STViewer", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, FilenetViewer, ErrorDialog, Desktop, Repository, Request, template], {
documentID: '',
templateString: template,
_setdocumentIDAttr: function(documentID) {
this.documentID = documentID;
},
constructor: function()
{
console.log(">> constructor Called <<");
},
postCreate: function() {
console.log("Trace 1 >>" + JSON.stringify(ecm.model.desktop) + "<<");
this.inherited(arguments);
var errorDialog = new ErrorDialog();
dojo.connect(ecm.model.desktop, onMessageAdded",errorDialog,"messageAddedHandler");
console.log("Trace 3 >>" + JSON.stringify(ecm.model.desktop) + "<<");
//Credentials needs to map with logged in user
var userId = 'username';
var password = 'password';
var desktopName = 'General';
ecm.model.desktop.servicesUrl = "http://8181testapp001/navigator";
ecm.model.desktop.loadDesktop(desktopName, function() {
console.log("Trace 3.2 >> ");
ecm.model.desktop.userId = userId;
console.log("Trace 3.3 >>" + userId + "<<,>>" + password + "<<");
ecm.model.desktop.logon(password, function() {
console.log("Trace 3.4 >> successfully logged on to desktop <<");
// alert("successfully logged on to desktop");
console.log("Trace 4");
var dtop = ecm.model.desktop;
var repository = dtop.getDefaultRepository();
//alert("sucessfully logged on to desktop");
console.log("Trace 4.1 >> " + JSON.stringify(repository) + "<<");
repository.userId = userId;
//repository.setUserId(userId);
repository.logon(password, function() {
console.log("Trace 4.2 >> successfully logged on to repository <<");
var itemId = 'FCEA28D1-6D78-4756-8171-8C33F47316CA';
repository.retrieveItem(itemId, function(item) {
console.log("Trace 5 >> Document retrieved Successfully <<");
this.filenetViewer.setitem(item);
console.log("Trace 5.2 >> Document set successfully" + JSON.stringify(this.filenetViewer) + " <<");
this.filenetViewer.showItem();
console.log("Trace 5.3 >> Document opened Successfully" + JSON.stringify(this.filenetViewer) + " <<");
});
});//repository.logon end
});// desktop.logon end
});//desktop.loadDesktop end
}, // postCreate
startup: function() {
this.inherited(arguments);
}
});// declare
ready(function() {
parser.parse();
});
});// require
模板html:
<div>
<div data-dojo-attach-point="filenetViewer" data-dojo-type="ecm.widget.viewer.FilenetViewer" style="width: 100%; height: 100%; position: absolute; margin: 0; overflow:hidden" isChildWindow="true" showNextPrev="false"sideChrome="0">
</div>
正文元素中的Dijit标记
<body class="ecm oneui">
<div >
<div data-dojo-type="STViewer" data-dojo-props="documentID:'FCEA28D1-6D78-4756-8171-8C33F47316CA'" > </div>
</div>
</body>