Connecting Tech Pros Worldwide Forums | Help | Site Map

Adding scroll to dynamic table

vikas251074's Avatar
Familiar Sight
 
Join Date: Dec 2007
Location: Patna
Posts: 198
#1: Jun 6 '08
I have created dynamic tables whose length depends upon the number of records.
Can I use scrollbar in tables?

My code for creating dynamic table is as follows -
Expand|Select|Wrap|Line Numbers
  1. <%
  2. dim conn
  3. set conn = Server.CreateObject("ADODB.Connection")
  4. conn.open = "Provider=MSDAORA.1;dsn=ops;password=op;user id=Outpass;Data Source=Intradb;Persist Security Info=True"
  5. set rs = server.CreateObject("ADODB.Recordset")
  6. set rs = conn.execute("Select gp_no, per_name, dept from gps")
  7. %>
  8. <script type="text/javascript" >
  9. window.onload = function() { dynamicTableInit(document.getElementById('myTable')); } ;
  10. </script>
  11. <br>
  12. <br>
  13. <br>
  14. <table id="myTable" class="dynamicTable" align="center" border="1" height="400px">
  15.   <thead>
  16.     <tr><th>Gatepass No.</th><th>Name of Person</th><th>Department</th></tr>
  17.   </thead>
  18.   <tbody>
  19. <%  do while not rs.eof %>
  20.       <tr><td><%=rs("gp_no")%></td><td><%=rs("per_name")%></td><td><%=rs("dept")%></td></tr>
  21. <%    rs.movenext
  22.     loop %>
  23.   </tbody>
  24. </table>
Is line no. 8,9, & 10 really needed?

Thanks and regards,
Vikas

gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,136
#2: Jun 6 '08

re: Adding scroll to dynamic table


hi ...

you cannot use a 'native' scrollbar in a table ... but you may use a div and set its overflow-css-property, or implement a custom scroller. or use a paging-mechanism with first 10 records, next etc.

to you other question: what does the function do? have a look at its code ... may be it adds some events for sorting the table or whatever. in case you! don't need it ... then its not needed ;) ... why do you have used it at the moment?

kind regards
vikas251074's Avatar
Familiar Sight
 
Join Date: Dec 2007
Location: Patna
Posts: 198
#3: Jun 6 '08

re: Adding scroll to dynamic table


All this contents have been collected from net searching. I think this line may be usefull thats why I added these lines.

Now I got the solution of scrollbar by adding below line
[HTML]<div align="center" class="myDiv" style="width: 520px; height: 435px; padding:4px; border: 0px ; overflow:auto ">[/HTML]

Thanks and regards,
Vikas
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,136
#4: Jun 6 '08

re: Adding scroll to dynamic table


glad to hear that ;) ... post back to the forum anytime you have more questions ...

kind regards
Reply


Similar JavaScript / Ajax / DHTML bytes