Tuesday, August 04, 2009

Resizing the infragistics web grid and column automatically

Set Body

body onload ="OnPageLoad();" onresize="SetGridSize();"

JavaScript function:


function OnPageLoad() {
SetGridSize();
}
function SetGridSize() {
//debugger;
//g_grdMediaAttachments_ClientID defined in the codeBehind
var webGrid = igtbl_getGridById(g_grdMediaAttachments_ClientID);
var band = webGrid.Bands[0];
var column = band.getColumnFromKey("Comments");
column.setWidth(GetResizedColumnWidth());

//Not sure why the total of the column width are not equal to frame width
var totalColumnWidth = GetResizedColumnWidth()) + GetFixedColumnWidth() - 34;
webGrid.MainGrid.style.width = totalColumnWidth + "px";


}
function GetResizedColumnWidth() {
var resizedColumnWidth = document.body.clientWidth - GetFixedColumnWidth();
if (resizedColumnWidth < resizedcolumnwidth =" 150;" fixedcolumnwidth =" 0;" fixedcolumnwidth =" fixedColumnWidth" fixedcolumnwidth =" fixedColumnWidth" fixedcolumnwidth =" fixedColumnWidth" fixedcolumnwidth =" fixedColumnWidth" fixedcolumnwidth =" fixedColumnWidth" fixedcolumnwidth =" fixedColumnWidth" width =" 0;" webgrid =" igtbl_getGridById(g_grdMediaAttachments_ClientID);" band =" webGrid.Bands[0];" column =" band.getColumnFromKey(columnName);" width =" column.getWidth();">

0 comments: