1

我有一个带有标题的 dgrid,除非我调整浏览器窗口的大小,否则这些标题不会出现。一旦我调整浏览器窗口的大小,标题就会出现。如何在不调整浏览器大小的情况下显示标题?

我没有正确调用 startup() 吗?有没有我可以触发的事件让 dgrid 认为浏览器已调整大小?

4

3 回答 3

1

将 DijitRegistry 添加到网格中,如下所示:

https://github.com/SitePen/dgrid/wiki/DijitRegistry

在内容窗格中放置一个 dijit Container(如果需要该窗格)并将网格添加为容器的子项。容器将在其子级上调用启动,这也会调整它们的大小。

于 2013-02-05T22:06:54.553 回答
0

所以我添加了一个onShow事件处理程序来ContentPane保存我的网格,并且每当它触发时,它都会调用grid.resize(). 很简单,但它有效。

于 2012-11-07T18:55:27.380 回答
0

刚刚解决了问题。所以,我的问题是:我以编程方式将 dgrid 添加到dijit/layout/ContentPane. 在其他浏览器中,除了 IE 6 之外,它工作正常。它没有显示 dgrid,直到我调整浏览器窗口的大小。我使用了 StackOverflow 和其他站点的许多解决方案。直到我没有为我的网格替换 css 规则(在一个 Stacks 的解决方案中找到)。

在某处我找到了下一个 CSS 规则:

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

没问题,但在 IE6 中不行。我被改为:

#dataGrid {
width: 100%;
height:100%;
}

现在在我所有的测试浏览器中都可以了。希望我能帮助你:) 完全添加工作 dgrid (Dojo 1.9):

HTML (my container):
<div class="centerPanel" id="centerPanel" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'center'" ></div> 

JS (I skipped reuires):
grid = new (declare([OnDemandGrid, DijitRegistry, ColumnResizer,Keyboard, Selection]))({
  columns: docListLayout,id:"dataGrid"
});
registry.byId("centerPanel").addChild(grid);

CSS:
#dataGrid {
width: 100%;
height:100%;
}

我还删除了带有宽度/高度声明的 centerPanel 的 CSS。

铜。

于 2014-03-19T00:07:54.303 回答