只是一个小问题,但它让我疯了。我想用TabContainers编写自己的小部件。现在看来,mixin-Classes无法调用TabContainer模块并启动它们。我尝试了很多不同小部件的东西,似乎TabContainer只有一个问题。查看Doc我无法弄清楚它是Dojo中的错误还是我的代码中的错误。尽管如此,这是有效的
<script type="text/template" id="editMultilanguageDialog-form-template">
<form data-dojo-type="dijit.form.Form" data-dojo-attach-point="form">
<button data-dojo-type="dijit/form/Button" data-dojo-props="iconClass:'dijitEditorIcon dijitEditorIconCut', showLabel: false" type="button">cut</button>
</form>
</script>
......但这不是!
<script type="text/template" id="editMultilanguageDialog-form-template">
<form data-dojo-type="dijit.form.Form" data-dojo-attach-point="form">
<div data-dojo-type="dijit/layout/TabContainer" style="width: 100%; height: 100%;">
<div data-dojo-type="dijit/layout/ContentPane" title="My first tab" data-dojo-props="selected:true">
Lorem ipsum and all around...
</div>
<div data-dojo-type="dijit/layout/ContentPane" title="My second tab">
Lorem ipsum and all around - second...
</div>
<div data-dojo-type="dijit/layout/ContentPane" title="My last tab" data-dojo-props="closable:true">
Lorem ipsum and all around - last...
</div>
</div>
</form>
</script>
在dialog.js中调用的代码如下所示:
define([ "modules/waitingDialog/dialog", "util/debugger", "stores/userStore",
"util/storeCache", "dojo/Evented", "dijit/Dialog", "dojo/_base/lang",
"dojo/_base/declare", "dijit/_Widget", "dijit/_TemplatedMixin",
"dijit/_WidgetsInTemplateMixin", "dojo/dom", "dojo/_base/Deferred",
"modules/editMultilanguageDialog/controller", "stores/facultyStore",
"stores/degreeStore", "stores/beginOfStudyStore" ], function(wait,
debug, userStore, storeCache, Evented, Dialog, lang, declare, widget,
templatedMixin, widgetsInTemplateMixin, dom, Deferred,
editMultilanguageController, facultyStore, degreeStore,
beginOfStudyStore) {
return declare("editMultilanguageDialog", [ Dialog, Evented ], {
attributeMap : lang.delegate(widget.prototype.attributeMap, {
message : {
node : "messageNode",
type : "innerHTML"
}
}),
constructor : function(/* Object */kwArgs) {
debug.log("constructor called",
"editMultilanguageDialog.constructor()", 1);
lang.mixin(this, kwArgs);
var controller = new editMultilanguageController(kwArgs);
this.controller = controller;
var dialogTemplate = dom.byId("dialog-template").textContent;
var formTemplate = dom
.byId("editMultilanguageDialog-form-template").textContent;
var template = lang.replace(dialogTemplate, {
form : formTemplate
});
var contentWidget = new (declare([ widget, templatedMixin,
widgetsInTemplateMixin ], {
templateString : template,
widgetsInTemplate : true
}));
var content = this.content = contentWidget;
this.form = content.form;
contentWidget.startup();
}, [...]
这个问题让我疯了。以为任何人都可能通过编写自定义小部件来体验相同的问题。 Thx提前!