当它的父容器调整大小时,自动调整dojo dijit.Grid小部件的大小 [英] Automatically Resize dojo dijit.Grid widget when it's parent container resizes
问题描述
我的TitlePane中有一个dojo网格小部件,其宽度设置为100%。
I have a dojo Grid widget inside a TitlePane with it's width set to 100%.
TitlePane是一个液体布局,因此它的宽度随浏览器窗口大小而变化。我遇到的问题是,当父窗口扩展(或收缩)时,网格本身不会更改其宽度。我可以通过在网格上调用render()来调整自己的大小,但是如何检测父窗口已经调整大小,以便我知道重新绘制网格窗口小部件?
The TitlePane is in a liquid layout so it's width changes with the browser window size. The problem I am having is that when the parent window expands (or contracts) the grid itself does not change it's width. I can get it to resize itself by calling render() on the grid, but how can I detect that the parent window has resized so that I know to redraw the grid widget?
推荐答案
我不得不偶尔这样做;这不是太难了:
I've had to do this on occasion; it's not too tough:
function resizeGrid() {
// do whatever you need here, e.g.:
myGrid.resize();
myGrid.update();
}
dojo.addOnLoad(function() {
dojo.connect(window, "onresize", resizeGrid);
});
这篇关于当它的父容器调整大小时,自动调整dojo dijit.Grid小部件的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!