Is it possible to have Dojo/Dijit DataGrid autoheight functionality based on the parent div size instead of a number of rows?

99封情书 提交于 2019-12-04 10:22:25

I think you're looking for grid.resize(); If you look at the file "Grid.js.uncompressed.js" in the dojox nightly files here: http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/ You can see exactly what it does. The dataGrid should inherit this method, if you're using it. One way to use it is to resize the containing div based on the window's height, and then resize the grid inside:

function changeHeight() {
    document.getElementById("div Id in which the dojo grid is there").style.height ="your desired height";
    dijit.byId('Id of the dojo grid').resize();
    dijit.byId('Id of the dojo grid').update();
}

Another option method is do do something like this:

function resizeGrid() {
   // do whatever you need here, e.g.:
   myGrid.resize();
   myGrid.update();
}

dojo.addOnLoad(function() {
    dojo.connect(window, "onresize", resizeGrid);
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!