Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NN6 equivalent code

 
Puneet Agarwal
Ranch Hand
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following piece of code which works fine in IE6.0
<TR class="tHead" style="top:expression(document.all('datatable').scrollTop)"> . 'datatable' is the id of a previously defined DIV tag. This piece of code doe not work in NN6.2 . What changes do I need to make so that it works in NN6.2 also.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
document.all is IE only
use: document.getElementById
here is a great site with JavaScript references
http://www.echoecho.com/javascript.htm
Eric
 
Yuriy Fuksenko
Ranch Hand
Posts: 413
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think expression() on works in NN6.2, or in NN at all.
You would have to go with some other way - event handling or setting a timer, like
setInterval("document.getElementById('row').style.left = document.getElementById('datatable').scrollTop;", 100);
or with some event handling
 
Puneet Agarwal
Ranch Hand
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I was trying to implement the fixed headers for tables feature. This piece of code worked perfectly for IE , but not for others. I tried the above mentioned things but I am able to get no where.
<DIV id="datatable" style ="overflow:auto;width:100%;height:80%"><FORM NAME="TemplateForm" METHOD="POST" ACTION="" TARGET="_self">
<TABLE ID="datalist" WIDTH="100%" CLASS="datatable">
<TR class="tHead" style="top:expression(document.all('datatable').scrollTop)">
<TD></B></TD>
<TD><B> </B></TD>
<TD></TD>
.
.
</TR> . This code works great in IE . It makes my table headers fixed. To make it work in NN , I wrote a javascript function where I did
document.getElementById('row).style.top = document.getElementById('datatable').style.top . This function I called in the onLoad event. I removed the style attrib from the <TR> tag .But this does not seem to have any effect.I am using a single TABLE for headers and datarows.
Please help me out on this issue.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to have static headers what you need to do is use 2 tables...
This has been talked about alot in the past couple of days so if you look down the list you can see the other topics on this matter.
Eric
 
Yuriy Fuksenko
Ranch Hand
Posts: 413
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The simpliest - do browser soecific code.
For IE do whatever you do,
For NN6+ it is very simple:
<table>
<thead>
<tr><td>Header1</td><td>Header2</td></tr>
</thead>
<tbody style="height:200px;overflow:auto;">
<tr><td>data1</td><td>data2</td></tr>
.
.
.
</tbody>
</table>
 
Puneet Agarwal
Ranch Hand
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
using <thead> and <tbody> does produce the desired effect. But specifying the correct height is a bit of headache. I am still struggling with it.Specifying the height in % is not working. I have lots of rows in my datatable (around 150). If i specify something like 200px ,then I cannot scroll all my elements in the table that is created. It shows only a few elements. Is there any way to overcome or remove this problem. I am using NN6+ .
 
Puneet Agarwal
Ranch Hand
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric talked about using 2 tables. But doesnt that cause a problem with alignment . I searched the forum for similar code but could not find. Any ideas or pointers for the above approach ?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a project I am working on
Version 1: Still Buggy with not a lot of friendliness:
http://www10.brinkster.com/a1ien51/Customize/IE_Idea.html
Version 2 which I am developing now but is slower:
http://www10.brinkster.com/A1ien51/Customize/dynamic_table.htm
Eric
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Plus you can also look at this thread with other people's code:
http://www.coderanch.com/forums/
And do not pay for that one!
Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic