如何根据外部容器节点的大小设置Dojo TitlePane的高度?

3
在下一个示例中,我在一个高度为200px的容器之间创建了一个TitlePane。我将TitlePane的高度设置为100%,但似乎不会扩展。
相关代码:
var titlePane = new TitlePane({
    title: "TITLE",
    toggleable: false,
    style: "height: 100%; overflow-y: auto",
    content: "foo"
});
var outerPane = new ContentPane({
    content: titlePane,
    style: "height: 200px;"
}, dojo.byId("body2"));

完整示例: http://jsfiddle.net/bzFPM/ 有什么想法吗?
2个回答

1
添加此样式。
.dijitTitlePaneContentOuter 
{
    height:80%;   
}

我不确定这是否是最佳选择。但它也能工作。

http://jsfiddle.net/bzFPM/4/


0

我找到了一个使用手风琴容器的解决方法。它在只包含标题窗格时看起来几乎相同。

function example(ContentPane, Accordion, Button){

var titlePane = new Accordion({
       style: "height: 100%; overflow-y: auto"
     });

var innerPane = new ContentPane({title:'TITLE', content:'foo'})

titlePane.addChild(innerPane);

var outerPane= new ContentPane({
    content:titlePane,
    style: "height: 200px;"
}, dojo.byId("body2"));

outerPane.startup()
var button= new Button({
    label:"add line",
    onClick:function(ev){
        innerPane.set("content", innerPane.get("content")+"<br>foo")
    }    
}).placeAt(dojo.byId("body2"), "after");
}

require(["dijit/layout/ContentPane", "dijit/layout/AccordionContainer",
     "dijit/form/Button"], example );

http://jsfiddle.net/bzFPM/5/


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接