I would like my webgrid to dynamically resize as I resize the browser window so that the webGrid's scrollbars are always visible. How do I do that?
Hi,
I was wondering about the size of the grid. If it's as wide as the page, then you can set the width of the grid to be 100% and that should take care of it. Here is how you can set it in code:
this.UltraWebGrid1.Width = Unit.Percentage(100);
If the grid is not as wide as the page, then I need more details on where and how the grid is displayed and how you want to resize it.
Thanks
Sarita
The problem isnt the width, Its the height. I want the height to automatically adjust so that I can alw***e the bottom horizontal scrollbar regardless of how I resize the browser. In other words, lets say that my webGrid starts (top) at 100px. If I resize the browser window so that the viewable area is 400px tall I want the webGrid to resize to be 300px tall.
Setting this.UltraWebGrid1.Height = Unit.Percentage(100); doesnt work this way. It simply makes the grid twice as tall as it needs to be (another problem) to contain all of the currently visible rows (adjusting for group-by selection).
I need it to dynamically adjust its height so that the bottom boundary of the grid moves at a constant offset with the bottom of the browser. It should alw***ow the bottom horizontal scrollbar. Is there a way?
Also, what's up with it showing twice as much height as it needs to?
i think you have to set the height of all the parent elements all the way up to body and html which you can do using css if you want to use 100%...
you could also set the size of the grid in pixels to an absolute height e.g. 347px and calculate the height when the window.onresize event is called by the browser. you can get from the document element what height the browser is currently displaying...so you might have in the resize event:
window.onresize = function() { // consider putting the next code in a timer...reduce the amount of times it will be called while using is dragging the window...
var offset = 100; // an amount of space to keep clear for other stuff such as menus
var newHeight = document.documentElement.clientHeight - offset; // this needs some more validation, such as when the clientHeight is less than the offset
igtbl_getGridById(gridId).resize(400,newHeight);
}