Active Server Pages Programming (ASP)/table scrolling in sync
Expert: Srini Nagarajan - 9/28/2005
Question-------------------------
Followup To
Question -
I have a table in an asp page. The user would like to have the table scroll data while keeping the first column fixed. Similar to EXCEL freeze columns. I have created two tables and I have almost got this working except that the fixed part of the table just expands in height to stay in sync. I have been looking at using frames to do this, but haven't had any luck.
The following is code of what I have tried. I am hoping I have included everything. There are other fields displayed in the table and other editing so I tried just cutting and pasting to show you what I have done so far without sending unnecessary code.
<script>
function sync()
{
var lft = document.all("dvData").scrollTop
document.all("dvHeader").style.height=300+lft
document.all("dvHeader").style.posBottom=300-lft
}
</script>
<div id="dvHeader" style="position:absolute; left:0; top:300; height:300; width:400; overflow:hidden">
<table width=200 border="0" align=left id="tblHeader">
<tr>
<td bgcolor="#296139"><P align=center> <font color="white" size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Lot Number ______</font></P> </td>
<% while not rs.EOF
</table></div>
<div id="dvData" style="position:absolute; left:300; top:300; height:300; width:800; overflow:auto" onscroll="sync()">
<table width=1000 border="0" align=right>
<td bgcolor="#296139"><P align=center> <font color="white" size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Expense Date</font></P> </td>
<% rs.movefirst
if rs.BOF and rs.EOF then %>
<td bgcolor="#f0e68c"><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">
<%=rs("expense_date")%>
</font></td>
</tr>
<% rs.MoveNext
wend %>
</table>
Any help would be appreciated!!
Answer -
Hi
Check this one
http://www.activewidgets.com/javascript.forum.3295.3/grid-won-t-load-in.html
and here is the DHTML version of Grid layout
http://www.java2s.com/Code/JavaScript/GUI-Components/Table-Grid.htm
Happy Programming!!
-srini
What I am trying to do is to have my table do what the table does at this site:
http://www.massless.org/_tests/grid1/
AnswerDid you try to download the code from that site and populate yours? infact activewidgets does something similiar to that...
You can cut some code from activewidgets and masseless.org you should be able to get the result..
Happy programming!
-srini