style="height:100%;table-layout: fixed;"
function adjustHeight() {
// Calculate the height of the header.
var headerHeight = 0;
var header = document.getElementById("applicationHeader");
if (header != null) {
headerHeight = header.offsetHeight;
}
// Calculate the height of the footer section.
var footerHeight = 0;
var footer = document.getElementById("footer");
if (footer != null) {
footerHeight = footer.offsetHeight;
}
// Calculate the height of application components that are always visible.
var applicationHeight = headerHeight + footerHeight;
// Target height for the remainder of the screen is the browser height
// minus the height of the fixed components.
var targetHeight = document.body.clientHeight - applicationHeight;
// Adjust the height of the scrollable segment.
var scroller = document.getElementById("scroll");
if (scroller != null) {
targetHeight -= 30;
window.status = "Scroll height to " + targetHeight + "=" + document.body.clientHeight + " clientHeight - " + applicationHeight + " (" + headerHeight + " headerHeight + " + footerHeight+ " footerHeight)";
scroller.style.setExpression("height", targetHeight);
}
}
window.onresize=adjustHeight;
<html>
<head>
<meta http-equiv="Content-Style-Type" content="text/css">
<LINK rel="stylesheet"
href="/afs/common/ActiveWidgets/runtime/styles/classic/grid.css"
type="text/css">
<title>Example Resize Page Grid with Nested HTML</title>
<script src="/afs/common/ActiveWidgets/runtime/lib/grid.js"
type="text/javascript"></script>
<script src="/afs/resizeGrid.js"
type="text/javascript"></script>
</head>
<body onload="adjustHeight()">
<!-- header -->
<div id="applicationHeader">
<table border="1" bordercolor="red">
<tr valign="top">
<td>Fixed Header</td>
</tr>
</table>
</div>
<!-- data -->
<div id="scroll">
<table style="height:100%;table-layout: fixed;">
<tr><td width="450px">
<xml id="dataGridXML"><rows>
<row>
<col tooltip="Hello?">Hello?</col>
<col tooltip="Is">Is</col>
<col tooltip="anyone">anyone</col>
<col tooltip="home?">home?</col>
</row>
<row>
<col tooltip="Nobody">Nobody</col>
<col tooltip="here">here</col>
<col tooltip="but us">but us</col>
<col tooltip="chickens.">chickens.</col>
</row>
<row>
<col tooltip="Hello?">Hello?</col>
<col tooltip="Is">Is</col>
<col tooltip="anyone">anyone</col>
<col tooltip="home?">home?</col>
</row>
<row>
<col tooltip="Nobody">Nobody</col>
<col tooltip="here">here</col>
<col tooltip="but us">but us</col>
<col tooltip="chickens.">chickens.</col>
</row>
<row>
<col tooltip="Hello?">Hello?</col>
<col tooltip="Is">Is</col>
<col tooltip="anyone">anyone</col>
<col tooltip="home?">home?</col>
</row>
<row>
<col tooltip="Nobody">Nobody</col>
<col tooltip="here">here</col>
<col tooltip="but us">but us</col>
<col tooltip="chickens.">chickens.</col>
</row>
<row>
<col tooltip="Hello?">Hello?</col>
<col tooltip="Is">Is</col>
<col tooltip="anyone">anyone</col>
<col tooltip="home?">home?</col>
</row>
<row>
<col tooltip="Nobody">Nobody</col>
<col tooltip="here">here</col>
<col tooltip="but us">but us</col>
<col tooltip="chickens.">chickens.</col>
</row>
<row>
<col tooltip="Hello?">Hello?</col>
<col tooltip="Is">Is</col>
<col tooltip="anyone">anyone</col>
<col tooltip="home?">home?</col>
</row>
<row>
<col tooltip="Nobody">Nobody</col>
<col tooltip="here">here</col>
<col tooltip="but us">but us</col>
<col tooltip="chickens.">chickens.</col>
</row>
<row>
<col tooltip="Hello?">Hello?</col>
<col tooltip="Is">Is</col>
<col tooltip="anyone">anyone</col>
<col tooltip="home?">home?</col>
</row>
<row>
<col tooltip="Nobody">Nobody</col>
<col tooltip="here">here</col>
<col tooltip="but us">but us</col>
<col tooltip="chickens.">chickens.</col>
</row>
<row>
<col tooltip="Hello?">Hello?</col>
<col tooltip="Is">Is</col>
<col tooltip="anyone">anyone</col>
<col tooltip="home?">home?</col>
</row>
<row>
<col tooltip="Nobody">Nobody</col>
<col tooltip="here">here</col>
<col tooltip="but us">but us</col>
<col tooltip="chickens.">chickens.</col>
</row>
<row>
<col tooltip="Hello?">Hello?</col>
<col tooltip="Is">Is</col>
<col tooltip="anyone">anyone</col>
<col tooltip="home?">home?</col>
</row>
<row>
<col tooltip="Nobody">Nobody</col>
<col tooltip="here">here</col>
<col tooltip="but us">but us</col>
<col tooltip="chickens.">chickens.</col>
</row>
</rows></xml>
<style id="dataGridStyle">
#dataGrid .active-column-0 {width:90px;}
#dataGrid .active-column-1 {width:90px;}
#dataGrid .active-column-2 {width:110px;}
#dataGrid .active-column-3 {width:110px;}
#dataGrid .active-grid-row {height: 20px;}
#dataGrid .active-row-cell {
border: #0000ff 1px solid;
}
</style>
<script language="javascript">
var dataGridCols=new Array();
dataGridCols[0]='Response';
dataGridCols[1]='A Column';
dataGridCols[2]='Next Column';
dataGridCols[3]='Final Column';
var dataGridTable = new Active.XML.Table;
var xml=document.getElementById("dataGridXML");
dataGridTable.setXML(xml);
var dataGridObj=new Active.Controls.Grid;
dataGridObj.setId("dataGrid")
dataGridObj.setProperty("column/count",4);
dataGridObj.setColumnHeaderHeight("20px");
dataGridObj.setRowHeaderWidth("0px");
dataGridObj.setModel("data",dataGridTable);
dataGridObj.setColumnText(function (i) {return dataGridCols[i]});
dataGridTable.getTooltip = function(i, j){ var node = this.getNode(i, j);return node ? node.getAttribute("tooltip") : "";};
dataGridObj.setDataModel(dataGridTable);
dataGridObj.getColumnTemplate().setAttribute("title",function(){return this.getItemProperty("tooltip")});
document.write(dataGridObj);
</script>
</td></tr>
</table>
</div>
<!-- footer -->
<table id="footer" border="1" bordercolor="black">
<tr>
<td>Fixed Footer</td>
</tr>
</table>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Style-Type" content="text/css">
<title>Example Resize Page of HTML Table</title>
<script src="/afs/resizeGrid.js" type="text/javascript"></script>
</head>
<body onload="adjustHeight()">
<!-- header -->
<div id="applicationHeader">
<table border="1" bordercolor="red">
<tr valign="top">
<td>Fixed Header</td>
</tr>
</table>
</div>
<!-- data -->
<div id="scroll" style="overflow-y: auto;">
<table border="1" bordercolor="blue">
<tr>
<td>Hi,</td>
<td>How</td>
<td>are</td>
<td>you?</td>
</tr>
<tr>
<td>Fine,</td>
<td>thanks.</td>
<td>And</td>
<td>you?</td>
</tr>
<tr>
<td>Hi,</td>
<td>How</td>
<td>are</td>
<td>you?</td>
</tr>
<tr>
<td>Fine,</td>
<td>thanks.</td>
<td>And</td>
<td>you?</td>
</tr>
<tr>
<td>Hi,</td>
<td>How</td>
<td>are</td>
<td>you?</td>
</tr>
<tr>
<td>Fine,</td>
<td>thanks.</td>
<td>And</td>
<td>you?</td>
</tr>
<tr>
<td>Hi,</td>
<td>How</td>
<td>are</td>
<td>you?</td>
</tr>
<tr>
<td>Fine,</td>
<td>thanks.</td>
<td>And</td>
<td>you?</td>
</tr>
<tr>
<td>Hi,</td>
<td>How</td>
<td>are</td>
<td>you?</td>
</tr>
<tr>
<td>Fine,</td>
<td>thanks.</td>
<td>And</td>
<td>you?</td>
</tr>
<tr>
<td>Hi,</td>
<td>How</td>
<td>are</td>
<td>you?</td>
</tr>
<tr>
<td>Fine,</td>
<td>thanks.</td>
<td>And</td>
<td>you?</td>
</tr>
<tr>
<td>Hi,</td>
<td>How</td>
<td>are</td>
<td>you?</td>
</tr>
<tr>
<td>Fine,</td>
<td>thanks.</td>
<td>And</td>
<td>you?</td>
</tr>
<tr>
<td>Hi,</td>
<td>How</td>
<td>are</td>
<td>you?</td>
</tr>
<tr>
<td>Fine,</td>
<td>thanks.</td>
<td>And</td>
<td>you?</td>
</tr>
<tr>
<td>Hi,</td>
<td>How</td>
<td>are</td>
<td>you?</td>
</tr>
<tr>
<td>Fine,</td>
<td>thanks.</td>
<td>And</td>
<td>you?</td>
</tr>
<tr>
<td>Hi,</td>
<td>How</td>
<td>are</td>
<td>you?</td>
</tr>
</TABLE>
</div>
<!-- footer -->
<table id="footer" border="1" bordercolor="black">
<tr>
<td>Fixed Footer</td>
</tr>
</table>
</body>
</html>
This topic is archived.