:: Forum >>

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.

Stephen
Friday, January 11, 2008
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)
Tuesday, January 15, 2008
Alex,

Here is the code that you requested

Stephen
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <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>

    
</head>

<body >

    <script>

        var docGrid= new AW.UI.Grid;
        docGrid.setId("FolderGrid");

        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.setColumnCount(8);
        docGrid.setRowCount(200);
        docGrid.setHeaderText(myHeaders);

        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){
            this.getRowTemplate(i).refresh();
        }

    
</script>

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

</body>
</html>
Stephen
Tuesday, January 15, 2008
Alex,

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

Stephen
Tuesday, January 15, 2008
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.setTimeout(function(){
        this.setContentHeight(h, "total");
        this._virtualController.paint.call(this);
    });
}
Alex (ActiveWidgets)
Thursday, January 17, 2008
Alex,

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?

Stephen
Thursday, January 17, 2008
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)
Thursday, January 17, 2008
Fixed in AW 2.5.2.

/general.bugs/2-5-2.html
Alex (ActiveWidgets)
Thursday, July 3, 2008

This topic is archived.


Back to support forum

Forum search