469,641 Members | 1,213 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,641 developers. It's quick & easy.

incremental table rendering, intermediate buffer flushing

W3C recommendations notwithstanding (see
http://w3.org/TR/html401/appendix/no...l#notes-tables) I can't
seem to persuade either of the leading browsers to do true incremental
table loading. Neither responds to COL/COLGROUP tags.

I have a very large data table which is being generated in
J/ECMA/JavaScript dynamically. I want to give the user some top rows
while the bottom rows are still loading. Without true incremental
table rendering I am down to the idea of trying to flush the buffer
halfway down the table, but I can't seem to be able to do that. Except
for inserting a call to "alert" (see below) with every other approach
the browser waits for the whole thing to load...

Basically, I have something like this:

<table>
<thead> <!-- pre-draw the headers -->
<tr>
<th>Header One</th>
<th>Header Two</th>
</tr>
</thead>
<tbody id="myData"> <!-- an empty TBODY -->
</tbody>
</table>

<script>
// call a function to write 20 rows from a data array
// the function adds rows and cells to the TBODY
// using tbody.insertRow and tr.insertCell calls
drawTable("myDataArray", 0, 20);

// what do I put here, between the two (or more) calls
// to drawTable to make the browser flush? the only
// thing that seems to do the trick (but is unacceptable)
// is a message box, i.e.:
alert("draw more?");
// I need something that has the same effect, but requires
// no user interaction

//call the function again to add the rest of the data
drawTable("myDataFile", 21, 2000);
</script>

Any help much appreciated (both with my general problem of displaying
a big HTML table in a user-friendly manner and with my immediate
problem of forcing a flush partway down). Thank in advance!

George
Jul 20 '05 #1
6 5209
Instead of the linw: drawTable("myDataFile", 21, 2000);
try: setInterval('drawTable("myDataFile", 21, 2000)',1);

"g pavlov" <ge*******@yahoo.com> wrote in message
news:79**************************@posting.google.c om...
W3C recommendations notwithstanding (see
http://w3.org/TR/html401/appendix/no...l#notes-tables) I can't
seem to persuade either of the leading browsers to do true incremental
table loading. Neither responds to COL/COLGROUP tags.

I have a very large data table which is being generated in
J/ECMA/JavaScript dynamically. I want to give the user some top rows
while the bottom rows are still loading. Without true incremental
table rendering I am down to the idea of trying to flush the buffer
halfway down the table, but I can't seem to be able to do that. Except
for inserting a call to "alert" (see below) with every other approach
the browser waits for the whole thing to load...

Basically, I have something like this:

<table>
<thead> <!-- pre-draw the headers -->
<tr>
<th>Header One</th>
<th>Header Two</th>
</tr>
</thead>
<tbody id="myData"> <!-- an empty TBODY -->
</tbody>
</table>

<script>
// call a function to write 20 rows from a data array
// the function adds rows and cells to the TBODY
// using tbody.insertRow and tr.insertCell calls
drawTable("myDataArray", 0, 20);

// what do I put here, between the two (or more) calls
// to drawTable to make the browser flush? the only
// thing that seems to do the trick (but is unacceptable)
// is a message box, i.e.:
alert("draw more?");
// I need something that has the same effect, but requires
// no user interaction

//call the function again to add the rest of the data
drawTable("myDataFile", 21, 2000);
</script>

Any help much appreciated (both with my general problem of displaying
a big HTML table in a user-friendly manner and with my immediate
problem of forcing a flush partway down). Thank in advance!

George

Jul 20 '05 #2
Oops, I ment: setTimeout('drawTable("myDataFile", 21, 2000)',1);
"Vic Sowers" <Ma**@VicSowers.com> wrote in message
news:3f***********************@news.hal-pc.org...
Instead of the linw: drawTable("myDataFile", 21, 2000);
try: setInterval('drawTable("myDataFile", 21, 2000)',1);

"g pavlov" <ge*******@yahoo.com> wrote in message
news:79**************************@posting.google.c om...
W3C recommendations notwithstanding (see
http://w3.org/TR/html401/appendix/no...l#notes-tables) I can't
seem to persuade either of the leading browsers to do true incremental
table loading. Neither responds to COL/COLGROUP tags.

I have a very large data table which is being generated in
J/ECMA/JavaScript dynamically. I want to give the user some top rows
while the bottom rows are still loading. Without true incremental
table rendering I am down to the idea of trying to flush the buffer
halfway down the table, but I can't seem to be able to do that. Except
for inserting a call to "alert" (see below) with every other approach
the browser waits for the whole thing to load...

Basically, I have something like this:

<table>
<thead> <!-- pre-draw the headers -->
<tr>
<th>Header One</th>
<th>Header Two</th>
</tr>
</thead>
<tbody id="myData"> <!-- an empty TBODY -->
</tbody>
</table>

<script>
// call a function to write 20 rows from a data array
// the function adds rows and cells to the TBODY
// using tbody.insertRow and tr.insertCell calls
drawTable("myDataArray", 0, 20);

// what do I put here, between the two (or more) calls
// to drawTable to make the browser flush? the only
// thing that seems to do the trick (but is unacceptable)
// is a message box, i.e.:
alert("draw more?");
// I need something that has the same effect, but requires
// no user interaction

//call the function again to add the rest of the data
drawTable("myDataFile", 21, 2000);
</script>

Any help much appreciated (both with my general problem of displaying
a big HTML table in a user-friendly manner and with my immediate
problem of forcing a flush partway down). Thank in advance!

George


Jul 20 '05 #3
"Vic Sowers" <Ma**@VicSowers.com> wrote in message news:<3f***********************@news.hal-pc.org>...
Oops, I ment: setTimeout('drawTable("myDataFile", 21, 2000)',1);


I have tried this. It makes no difference. The table does not draw
incrementally.

Were you proposing this because you know it works (in which case I
have to check my browser versions) or because you _think_ it might
work?

Again, the only things that seem to flush the buffer are
intrusive/unacceptable things like throwing an alert(), a confirm() or
a window.showModalDialog(). Even window.showModelessDialog() does not
do the trick...

George
Jul 20 '05 #4

"g pavlov" <ge*******@yahoo.com> wrote in message
news:79**************************@posting.google.c om...
"Vic Sowers" <Ma**@VicSowers.com> wrote in message

news:<3f***********************@news.hal-pc.org>...
Oops, I ment: setTimeout('drawTable("myDataFile", 21, 2000)',1);


I have tried this. It makes no difference. The table does not draw
incrementally.

Were you proposing this because you know it works (in which case I
have to check my browser versions) or because you _think_ it might
work?

Again, the only things that seem to flush the buffer are
intrusive/unacceptable things like throwing an alert(), a confirm() or
a window.showModalDialog(). Even window.showModelessDialog() does not
do the trick...

George


I run the following in IE 6.0 and the rows fill and display every second:

<html>
<head>
<title>Incremental Row Addition</title>
</head>

<body>
<table id="Incr" border="1"></table>
<script language="JavaScript">
var Rows=0;
function FillRows() {
var row = Incr.insertRow();
var cell = row.insertCell();
cell.innerText = Rows++;
var cell = row.insertCell();
cell.innerText = Math.random();
if (Rows<10) setTimeout("FillRows()",1000);
}
FillRows();
</script>
</body>
</html>

This should work on recent versions of IE (>=4.0) but I don't know if it
will work on NS. Probably not, at least as written. NS accesses its elements
differently, but I think the 'setTimeout' technique might work.

Vic
Jul 20 '05 #5
You are right. It does work in IE for me too now. I can't reproduce
what I was doing before when it wasn't flushing. Thanks!
Jul 20 '05 #6
"g pavlov" <ge*******@yahoo.com> wrote in message
news:79**************************@posting.google.c om...
You are right. It does work in IE for me too now. I can't reproduce
what I was doing before when it wasn't flushing. Thanks!

Have you tried using setTimeout to draw each row?
On our intranet I use ScriptX from meadroid. It's free and has a wait method
that equals VBs doEvents call. You can call it after each row is drawn or
each group of rows.

--

Joe

Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Rob Freundlich | last post: by
3 posts views Thread by apple | last post: by
3 posts views Thread by Eric | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.