繁体   English   中英

如何在BorderContainer(Dojo)中动态调整ContentPane的大小

[英]How to dynamically resize ContentPane inside BorderContainer (dojo)

有人可以帮我吗? 我想实现放置在BorderContainer中的ContentPane的自动调整大小。 这是一个简单的测试用例: http : //jsfiddle.net/3dft2/1/在这种情况下,我在ContentPane内有TitlePane(但一般来说,里面可能有任何内容)。 当我单击TitlePane(并且打开=>内容高度更改)时,我想相应地自动调整ContentPane的大小。 即我想移动分离器。 如何归档? 如果更改大小,如何观看内容大小(无论哪种内容)并自动调整ContentPane的大小?

测试用例:

dojo.require("dijit.TitlePane");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.BorderContainer");
dojo.ready(function() {
     // create a BorderContainer as the top widget in the hierarchy
    var bc = new dijit.layout.BorderContainer({
        style: "height: 300px; width: 500px;"
    });

    var TitlePane = new dijit.TitlePane({
        title: 'title pane',
        open: false,
        content: "Collapse me!"        
    });

    // create a ContentPane as the left pane in the BorderContainer
    var cp1 = new dijit.layout.ContentPane({
        region: "top",
        style: "width: 100px",
        content: TitlePane,
        splitter: "true"
    });
    bc.addChild(cp1);

    // create a ContentPane as the center pane in the BorderContainer
    var cp2 = new dijit.layout.ContentPane({
        region: "center",
        content: "how are you?"
    });
    bc.addChild(cp2);

    // put the top level widget into the document, and then call startup()
    bc.placeAt(document.body);
    bc.startup();
});

折叠标题窗格后,使用其style属性相应地降低高度。 并且当它扩展时,您可以根据需要设置添加高度。 无论如何,已经有用于此的方法。 我们只需要添加用于设置高度的代码即可。 也许,如果您有滚动条,那是您的问题,请增加Border容器的高度。 默认情况下,内容窗格的大小会自动调整。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM