本文介绍了Dgrid在BorderContainer内调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在BorderContainer中使用了一个dgrid,并启用了liveSplitters(使用Dojo 1.8)。 dgrid很好地出现,但是当我在左列和引导列(dgrid在其中)之间移动分隔符时,dgrid无法正确调整大小。但是,如果我将窗口调整大小,那么dgrid会恢复到适当的大小(即填充BorderContainer的前导窗格的100%)。

I have a dgrid within a BorderContainer with "liveSplitters" enabled (using Dojo 1.8). The dgrid comes up nicely, but when I move the splitter between the left column and the "leading" column (that the dgrid is within), the dgrid does not properly resize. However, if I resize the window a tad, then the dgrid snaps back into a proper size (i.e. filling 100% of the "leading" pane of the BorderContainer).

我将dgrid设置为CSS中的100%宽度。有一些方法我需要告诉dgrid刷新分割器移动后的大小?

I have dgrid set to 100% width in CSS. Is there some way I need to tell dgrid to refresh its size after the splitter moves?

推荐答案

看这个例子我写了回答另一个 dgrid 相关问题:

Look at this example I wrote answering another dgrid related question: http://jsfiddle.net/phusick/VjJBT/

您要查找的CSS规则是:

The CSS rule you are looking for is:

#grid {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
}

编辑:我以为可能是 dgrid 版本的问题,所以我将我的 dgrid 更新到最新版本0.3.3,并创建了一个测试问题的人:。

I thought it might have been a problem of dgrid version, so I updated my dgrid to the latest version 0.3.3 and created a test for the issue of yours: http://jsfiddle.net/phusick/5mHTS/.

嗯,这不是版本的问题,当调整 BorderContainer 时,0.3.1和0.3.3都可以正常工作,但只能在Chrome和Firefox。我在IE9和Opera 12.10中转载了这个问题:

Well, it was not the issue of versions and both 0.3.1 and 0.3.3 works fine when resizing BorderContainer, but only in Chrome and Firefox. I reproduced the issue in IE9 and Opera 12.10:

网格需要调用 grid.resize()正确调整大小,发生在IE9 / Opera中,当调整 BorderContainer 的大小时,但是当您调整窗口大小时始终会发生。

The grid needs to invoke grid.resize() to resize properly, which does not happen in IE9/Opera, when resizing BorderContainer, but happens always when you resize the window.

DijitRegistry 修复问题,因为布局组件,如 BorderContainer ContentPane 调整大小后,调用 resize()

DijitRegistry fixes the issue, because layout components, like BorderContainer and ContentPane, call resize() on all their dijit children when resized.

所以这两个子类 DijitRegistry dojo / aspect 收听 resize code> ContentPane 并调用 grid :: resize()

So either subclass DijitRegistry or dojo/aspect listen for resize on parent ContentPane of the grid and invoke grid::resize():

aspect.after(contentPane, "resize", function() {
    grid.resize();
});

这篇关于Dgrid在BorderContainer内调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 23:39