Adding scroll to dynamic table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vikas251074
    New Member
    • Dec 2007
    • 198

    Adding scroll to dynamic table

    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 -
    Code:
    <%
    dim conn
    set conn = Server.CreateObject("ADODB.Connection")
    conn.open = "Provider=MSDAORA.1;dsn=ops;password=op;user id=Outpass;Data Source=Intradb;Persist Security Info=True"
    set rs = server.CreateObject("ADODB.Recordset")
    set rs = conn.execute("Select gp_no, per_name, dept from gps")
    %>
    <script type="text/javascript" >
    window.onload = function() { dynamicTableInit(document.getElementById('myTable')); } ;
    </script>
    <br>
    <br>
    <br>
    <table id="myTable" class="dynamicTable" align="center" border="1" height="400px">
      <thead>
        <tr><th>Gatepass No.</th><th>Name of Person</th><th>Department</th></tr>
      </thead>
      <tbody>
    <%  do while not rs.eof %>
          <tr><td><%=rs("gp_no")%></td><td><%=rs("per_name")%></td><td><%=rs("dept")%></td></tr>
    <%    rs.movenext
        loop %>
      </tbody>
    </table>
    Is line no. 8,9, & 10 really needed?

    Thanks and regards,
    Vikas
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    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

    Comment

    • vikas251074
      New Member
      • Dec 2007
      • 198

      #3
      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
      Last edited by gits; Jun 6 '08, 04:43 PM. Reason: added code tags

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

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

        kind regards

        Comment

        Working...