0

在显示 dijit.layout.tabContainer 时遇到问题。

我以编程方式添加它,添加一个 contentPane 并在 DOM 中显示得很好。

没有 JS 错误或警告,我可以看到控件是通过 Chrome 开发人员工具创建的,我只是看不到它们。

tabContainer 有一个高度和宽度。

苔原主题正在使用,苔原的 CSS 文件包括在内。

1     dojo . create( "div", { id : "clientData" }, "ctrlPanel" );
2 
3     /*
4      * Create the tab control
5      */
6     var tc = new dijit.layout.TabContainer( { style : 'width:100%, height:100%' }, 'clientData' );
7 
8     /*
9      * Add a content pane
10      */
11     var cp1 = new dijit.layout.ContentPane( {
12           title   : "Basic",
13           content : 'replace me'
14     } );
15 
16     tc.addChild(cp1);
17     tc.startup();

有任何想法吗?

4

1 回答 1

0

我相信问题只是你用逗号而不是分号分隔 TabContainer 的样式指令。也就是说,尝试将该行更改为:

var tc = new dijit.layout.TabContainer({style: 'width:100%; height:100%' }, 'clientData');

由于您将其设置为父容器的 100% 宽度和高度,因此您还需要确保 ctrlPanel div 具有大小(如果您还没有)。

于 2011-06-17T14:57:01.573 回答