dGrid中的100%高度

voi*_*ate 7 dojo dgrid

如何使dGrid实例占据其容器高度的100%?我可以使用CSS将".dgrid"分类div设置为特定高度,但是当我将其设置为100%时,它不会显示.

voi*_*ate 12

得到它了.

.dgrid {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
}
Run Code Online (Sandbox Code Playgroud)

(当然,在容器上有绝对/相对位置)

  • 一些额外的细节:[_Dgrid在BorderContainer_中调整大小](http://stackoverflow.com/questions/13427937/dgrid-resizing-within-bordercontainer/13436318#13436318);) (3认同)

Ste*_*eve 5

我认为支持的方法是使用.dgrid-autoheight css类。

        require([
            "dgrid/List",
            "dgrid/OnDemandGrid",
            "dgrid/Selection",
            "dgrid/Keyboard",
            "dojo/_base/declare",
            "dgrid/test/data/createAsyncStore",
            "dgrid/test/data/smallColorData",
            "dojo/domReady!"
        ], function(List, Grid, Selection, Keyboard, declare, createAsyncStore, smallColorData){
                window.grid = new (declare([Grid, Selection, Keyboard]))({
                    className: "dgrid-autoheight",
                    collection: createAsyncStore({ data: smallColorData }),
                    columns: {
                        col1: "Color",
                        col5: "R",
                        col6: "G",
                        col7: "B"
                    }
                }, "grid");
            });
Run Code Online (Sandbox Code Playgroud)

这是来自测试示例