dgrid onDemandGrid渲染的大于它所在的空间,因此导致垂直滚动

时间:2015-12-11 20:43:20

标签: dojo dgrid

我正在尝试渲染dgrid而没有显示垂直滚动条,但由于某种原因,它总是渲染得比它所在的空间大。

当网格加载时,即使空间仅为300x200,它也会渲染为400x300,从而导致垂直滚动。我该如何预防?

addGrid: function () {
                this.grid = (declare([OnDemandGrid, Selection]))({
                    id: "tgrid" + this.reportId,
                    loadingMessage: 'Loading data...',
                    noDataMessage: 'No results found.',
                    allowTextSelection: true,
                    scroller: true,
                    collection: new Memory({
                        idProperty: "id"
                    }),
                    columns: {
                        trackName: "Name",
                        urn: {
                            label: "URN",
                            renderCell: function(object, value, cell) {
                                if(typeof value === 'undefined' ) {
                                    cell.bgColor = "red";
                                } else {
                                    cell.innerHTML = value;
                                }
                            }
                        },
                        location: "Location",
                        affiliation: "Affiliation",
                        eta: "ETA",
                        lta: "LTA"
                    }
                }, this.gridId);
                //next get the tracks using this call
                this.getTracks();
            }
.dgrid {
    height: auto;
}

.dgrid-row {
    padding: 3px 0 2px 9px;
}

.dgrid-scroller {
    position: relative;
    overflow: auto;
    max-height: 95%;
}

0 个答案:

没有答案