I have a WebGrid that has its width and height set to 100%, so that when the window is resized ideally the webgrid would resize to fit.
This works for the width perfectly, as I make the window smaller the WebGrid's width is equally reduced and the scroll bar appears along the bottom of the WebGrid.
This does not work for the height, the height stays fixed, so as I make the window smaller I get a scroll bar on the window, instead of the WebGrid's height reducing and adding the scroll bar IN the WebGrid.
any help is appreciated! I dont know if there is a setting somewhere I need to set to get this to work.
you can use grid.resize() javascript function to resize your grid on window.onresize event
look at my other post http://forums.infragistics.com/forums/t/2726.aspx
Where do you set the onresize event, in the body tag?
ie. <body onresize="uwgLoanApplications_InitializeLayoutHandler(gridName)">
or somewhere else?
I tried the above, putting in the body onresize event, but I get an infinite loop in IE7. Looks like the infragistcs command to resize would call the onresize event and it just loops infinitely bringing IE to a halt. (I Debugged the javascript with visual studio to confirm problem). Is there a setting somewhere so that the webgrid does not call onresize event when we do grid.resize(widht,height) ?
We got arround the infinite loop by using clientHeight on the document instead of offsetHeight on the enclosing div. Using this causes loop:
document.getElementById('caca').offsetHeight
Where <div id=caca> is the div that encloses the WebGrid. Thanks for the help, we're all good now.
Would you provide a bit more information?
I tried this in a resize event but it had no effect:
var height = document.documentElement.clientHeight; var grid = igtbl_getGridById("UG1"); var div = grid.getDivElement(); div.style.maxHeight = height;
It seems that this should be easy. If the grid is not going to abide by the height property given to it, then why provide that property?
Thanks for your help.
hello chris,
the maxHieght property works only for IE7, mozilla 2.0 and above and doesnt work for IE6.
I currently have the following solution impelemnted which works for all these browsers.
gridHeight= clientHigh-100;
grid.resize(grid.MainGrid.offsetParent.offsetWidth - 4, gridHeight)
document.getElementById(tableId).style.height =
grid.alignStatMargins();
<body onresize ="BLOCKED SCRIPTWindow_Resize(this);" onload ="BLOCKED SCRIPTWindow_Resize(this);">
<script id="igClientScript" type="text/javascript">
function Window_Resize(obj) { var grid = igtbl_getGridById("UltraWebGrid1"); //grid.resize method not working in verion 8.1, only work well in 7.2 //grid.resize(document.documentElement .clientWidth -20 ,document.documentElement .clientHeight - 50 ); DocWidth = (document.documentElement .clientWidth - 20 < 1) ? 1 : (document.documentElement .clientWidth - 20); DocHeight = (document.documentElement .clientHeight - 160 < 1) ? 1 : (document.documentElement .clientHeight - 50); grid.MainGrid.style.width = DocWidth + "px"; grid.MainGrid.style.height = DocHeight + "px"; }
</script>