Log in

View Full Version : AJAX assisted table rows display



illibaro
08-26-2007, 07:24 AM
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

jscheuer1
08-26-2007, 10:18 AM
If your table content remains stable after page load, you don't need Ajax or even any kind of script:


<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.

illibaro
08-26-2007, 05:48 PM
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

jscheuer1
08-26-2007, 09:08 PM
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.