Why will the headings in my dojo dgrid not appear unless I resize the browser?

99封情书 提交于 2019-12-13 00:39:21

问题


I've got a dgrid with headings that will not appear unless I resize the browser window. As soon as I resize the browser window, the headings appear. How can I get the headings to show up without resizing the browser?

Am I not calling startup() correctly? Is there an event I can fire to make the dgrid think the browser has been resized?


回答1:


Put add the DijitRegistry to the grid as shown here:

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

Put a dijit Container in your content pane (if the pane is necessary) and add the grid as a child of the container. The container will call startup on its children which resizes them also.




回答2:


Just solved issue. So, my problem was: I programmatically add dgrid into dijit/layout/ContentPane . Across other browsers its work fine except IE 6. It didn't show dgrid unti I resize browsers' window. I have used many solutions from the StackOverflow and other sites. Until I didn't replace css rule for my grid (found in one Stacks' solution).

Somewhere I found the next css rule:

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

Its ok, but not in IE6. I was changed to:

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

And its ok now across all my testing browsers. Hope I help you :) Totally adding working 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%;
}

Also I removed CSS for my centerPanel with width/height declarations.

CU.




回答3:


So I added an onShow event handler to the ContentPane that held my grid, and whenever it fires, it calls grid.resize(). Simple, but it works.



来源:https://stackoverflow.com/questions/13184341/why-will-the-headings-in-my-dojo-dgrid-not-appear-unless-i-resize-the-browser

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!