dynamic height on a data grid not working for 2.5.1

Under version 2.0.2 for the datagrid I was setting the grid height
using the command
grid.setStyle('height', '80%');
and it work fine.

I loaded up the new 2.5.1 version and now it will only initially display 6 lines. If I set the height to a fix size, there is not problem. Is this not an option anymore with the newer version.

January 11,
Should be a bug - could you post (or send me) a full page html? I guess this is some kind of problem with nested tables layout.
Alex (ActiveWidgets)
January 15,

Here is the code that you requested

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <title>Content Management</title>

    <link href="../runtime/styles/xp/aw.css" rel="stylesheet" type="text/css"/>
    <script language="JavaScript" src="../runtime/lib/aw.js"></script>


<body >


        var docGrid= new AW.UI.Grid;

        var myHeaders = ["","Col1", "Col2", "Col3", "Col4","Col5","Col6","Col7"];

        var colWidth = new Array(5,10,30,10,10,10,15,10);	  //set percentages for column width
        docGrid.setColumnIndices([0,1,2,3,4,5,6,7]); // this hides the first column			

        docGrid.setCellData(function(col, row){return "cell " + col + "." + row});
        docGrid.setCellTemplate(new AW.Templates.Radio, 0); 

        docGrid.setStyle('height', '80%');
        docGrid.setStyle('width', '100%'); 		
        docGrid.setSelectionMode("single-row");   //set seletion for all the row
        docGrid.onRowSelectedChanged = function(value, i){ 


  <table width="100%" height="100%" border="0" align="center" cellpadding="2" cellspacing="3">
          <DIV id="myDiv" width="100%" height="100%"></DIV> 
   	document.getElementById("myDiv").innerHTML = docGrid.toString();
January 15,

Ignore the variable "colWidth". For got to remove it. It does not do anything.

January 15,
This is indeed a bug in the grid initialization procedure - the total height value is incorrect. It will be corrected in the next bug-fix release. Please try the following code as a temporary workaround -

docGrid.paint = function(){
    var h = this.getScrollTemplate().element().offsetHeight;
        this.setContentHeight(h, "total");
Alex (ActiveWidgets)
January 17,

Thanks, that fixed the problem in IE. I did notice that the grid does not display correctly in firefox when I use a percentage for the hieght. It does display correctly when I put in a actual number. Is this just a IE vs. Firefox thing?

January 17,
You have to specify the DIV height in Firefox. The DIV element does not have width and height attributes so you have to specify width/height using style -

<DIV id="myDiv" style="width:100%;height:100%"></DIV>
Alex (ActiveWidgets)
January 17,
Fixed in AW 2.5.2.

Alex (ActiveWidgets)
July 3,

This topic is archived.

See also:

Back to support forum