Connecting Tech Pros Worldwide Forums | Help | Site Map

incremental table rendering, intermediate buffer flushing

g pavlov
Guest
 
Posts: n/a
#1: Jul 20 '05
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

Vic Sowers
Guest
 
Posts: n/a
#2: Jul 20 '05

re: incremental table rendering, intermediate buffer flushing


Instead of the linw: drawTable("myDataFile", 21, 2000);
try: setInterval('drawTable("myDataFile", 21, 2000)',1);

"g pavlov" <geopavlov@yahoo.com> wrote in message
news:79d542f2.0309180856.570d44c4@posting.google.c om...[color=blue]
> 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[/color]


Vic Sowers
Guest
 
Posts: n/a
#3: Jul 20 '05

re: incremental table rendering, intermediate buffer flushing


Oops, I ment: setTimeout('drawTable("myDataFile", 21, 2000)',1);


"Vic Sowers" <Mail@VicSowers.com> wrote in message
news:3f69f393$0$67773$a726171b@news.hal-pc.org...[color=blue]
> Instead of the linw: drawTable("myDataFile", 21, 2000);
> try: setInterval('drawTable("myDataFile", 21, 2000)',1);
>
> "g pavlov" <geopavlov@yahoo.com> wrote in message
> news:79d542f2.0309180856.570d44c4@posting.google.c om...[color=green]
> > 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[/color]
>
>[/color]


g pavlov
Guest
 
Posts: n/a
#4: Jul 20 '05

re: incremental table rendering, intermediate buffer flushing


"Vic Sowers" <Mail@VicSowers.com> wrote in message news:<3f69f3ea$0$67771$a726171b@news.hal-pc.org>...[color=blue]
> Oops, I ment: setTimeout('drawTable("myDataFile", 21, 2000)',1);[/color]

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
Vic Sowers
Guest
 
Posts: n/a
#5: Jul 20 '05

re: incremental table rendering, intermediate buffer flushing



"g pavlov" <geopavlov@yahoo.com> wrote in message
news:79d542f2.0309191512.40c24d0e@posting.google.c om...[color=blue]
> "Vic Sowers" <Mail@VicSowers.com> wrote in message[/color]
news:<3f69f3ea$0$67771$a726171b@news.hal-pc.org>...[color=blue][color=green]
> > Oops, I ment: setTimeout('drawTable("myDataFile", 21, 2000)',1);[/color]
>
> 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[/color]

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


g pavlov
Guest
 
Posts: n/a
#6: Jul 20 '05

re: incremental table rendering, intermediate buffer flushing


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!
Joe Fawcett
Guest
 
Posts: n/a
#7: Jul 20 '05

re: incremental table rendering, intermediate buffer flushing


"g pavlov" <geopavlov@yahoo.com> wrote in message
news:79d542f2.0309301231.25085b90@posting.google.c om...[color=blue]
> 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![/color]
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



Closed Thread