简体   繁体   English

根据dijit.layout.BorderContainer的大小调整内部div的大小

[英]Resizing inner div on resizing size of dijit.layout.BorderContainer

I have a div of dojoType dijit.layout.BorderContainer , And i am trying to set the size of this bordercontainer dynamically with respect to size of the viewport. 我有一个dojoType dijit.layout.BorderContainer的div,并且我试图相对于视口的大小动态设置此bordercontainer的大小。 The html code to create the border container is 创建边框容器的html代码是

    <div dojoType="dijit.layout.BorderContainer" design="sidebar" gutters="true" liveSplitters="true" id="borderContainer" style="border: solid green 3px;">
<div dojoType="dijit.layout.ContentPane" splitter="true" region="leading" style="width: 230px; padding:2px 0px 0px 0px;">
</div>
</div>

I am updating the size of the border container using the following javascript code 我正在使用以下JavaScript代码更新边框容器的大小

var viewport    =   dojo.window.getBox(dojo.doc);
dojo.setStyle('borderContainer','height','430px');

but on executing the code i was able to see the size of the div of type border container to be changed, however the div inside the div of type bordercontainer is not changing. 但是在执行代码时,我能够看到要更改的边框容器的div的大小,但是bordercontainer类型的div内的div并没有改变。

You will need to call resize on the widget and the widget will resize its children. 您将需要在小部件上调用resize ,小部件将调整其子级的大小。

var viewport    =   dojo.window.getBox(dojo.doc);
var borderContainer = dijit.byId('borderContainer');

dojo.setStyle(borderContainer.domNode, 'height','430px');
borderContainer.resize();

An alternative approach 另一种方法

When I want the border container to take up the whole screen, I will set it's height and width to 100%. 当我希望边框容器占据整个屏幕时,我会将其heightwidth为100%。 All parent dom nodes of the border container will also need a height of 100% set (ie <html> , <body> , etc.) 边框容器的所有父dom节点也将需要设置100%的高度(即<html><body>等)

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

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