Results 1 to 4 of 4

Thread: AJAX assisted table rows display

  1. #1
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default AJAX assisted table rows display

    Gurus:

    I have a table which hold around 1000 rows. I need to show rows from this table around 10 rows at a time inside a DIV.

    I am looking for an ajax script which can be leveraged while dragging the vertical scroll bar down - essentially when the scroll bar is at the top, I should see rows 1 to 10. When scrollbar is somewhere in the middle - ajax scrip should automatically calculate the corresponding rows and say show rows from 501 to 510. Similarly when the scroll bar is at the lowest level, it should show rows 991 to 1000.

    At the bottom of this table, i would also like to show total number of rows (records) and also the rwo #s of the current rows being shown.

    I donot know want to load all 1000 rows at the same time!

    Would appreciate advise..

    Thanks - illibaro

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    If your table content remains stable after page load, you don't need Ajax or even any kind of script:

    HTML Code:
    <div style="width:30em;height:70em;overflow:auto;">
    <table style="width:30em;" border="0">
    
    table rows and cells here
    
    </table>
    </div>
    The widths and height are just suggestions, the width of the table should be equal to, or even slightly less than the containing division. The height of the division controls how many table rows are visible at any given time. Using overflow:auto on the division allows for a scrollbar if the height of the contents of the table is greater than the height of the division.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John: I appreciate your very prompt advise. I however forgot to mention, my data does indeed changes after page load.. would appreciate inputs..

    Thanks - illibaro

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Even so, as long as you already have that mechanism (that dynamically changes the data in the table) in place and working, my above HTML markup suggestion should still accommodate it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •