我有一个包含3个内容窗格的标签容器,只有在重新调整浏览器大小时才加载,但在实际页面加载期间不加载。模板文件TContainer.html如下所示
<div style="width:100%;height:100%" >
<div dojoType="dijit.layout.TabContainer" data-dojo-attach-point="tab" open="true" tabPosition="top" style="width:100%; margin:5px;font-weight:bold; overflow-y:visible;" tabStrip="true" doLayout="false">
<!-- content panes: title is tab name, make this tab selected -->
<div dojoType="dijit.layout.ContentPane" style="width:100%;height:100%;" data-dojo-props="title:'Tab1',selected:'true'">
</div>
<!-- content panes: title is tab name, no special features here -->
<div dojoType="dijit.layout.ContentPane" style="width:100%;height:100%;" data-dojo-props="title:'Tab2'">
</div>
<!-- content panes: title is tab name, make this tab closable -->
<div dojoType="dijit.layout.ContentPane" style="width:100%;height:100%;" data-dojo-props="title:'Tab3'">
</div>
</div>
小部件的关联TContainer.js文件如下
define([
"dojo/_base/declare",
"dojo/_base/fx",
"dojo/_base/lang",
"dojo/dom-style",
"dojo/mouse",
"dojo/on",
"dojo/query",
"dijit/layout/TabContainer",
"dijit/layout/ContentPane",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dijit/_WidgetsInTemplateMixin",
"dojo/text!./templates/TabContainer.html"
],function(declare,baseFx,lang,domStyle,mouse,on,query,TabContainer,ContentPane,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,template){ return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{
templateString: template,
c1:"content1",
c2:"content2",
c3:"content3",
// A class to be applied to the root node in our template
baseClass: "tabWidget",
constructor: function (args) {
// Allow pages variable to be set at runtime
declare.safeMixin(this, args);
},
resize: function () {
this.tab.resize(arguments);
this.inherited(arguments);
},
postCreate: function(){
// Run any parent postCreate processes - can be done at any point
this.inherited(arguments);
},
});
});
我使用以下代码以编程方式创建窗口小部件
var Tab = new TContainer({"c1" : "content1",
"c2":"content2",
"c3":"content3 answers"
});
//dnode is a div node
Tab.placeAt(dnode);
Tab.startup();
Tab.resize();
答案 0 :(得分:0)
高度和宽度,而不是父容器的大小(必须是此处的内容窗格)不会呈现为选项卡容器的大小,因此除非您手动调整浏览器大小或以编程方式强制调整大小功能,否则它将赢得&# 39;工作。
您也可以在启动后使用以下内容:
resize: function () {
this.parentCont.resize(arguments); //here parentCont is the widget attach point
this.inherited(arguments);
}
答案 1 :(得分:0)
似乎那个controllerWidget:&#39; dijit.layout.TabController&#39;需要在tabcontainer标记中定义属性。它现在运行正常,没有任何问题。谢谢https://bugs.dojotoolkit.org/ticket/10113#comment:11