Client-side problem scripting problem. I have a table of about 300 rows with
many columns. User chooses to sort on one column. Sort is very fast (I do
this by extracting the column data along with its index and then using the
array sort with). The problem is with the following code that I took from
MSDN's DHTML Dude's article:
//TheBody is is a tbody with id "TheBody". It is at the end of the table
// and is where we are inserting the sorted rows.
//aSortedArray - contains a string with with "|" separators. The last one
is
//the index into the original rows to be sorted.
var i, r, b, d, s,j,a;
b = TheBody;
var rtr=ResultsTable.rows
var ri;
//Display the sorted rows
for (i=1; i<count; i++) {
a=aSortedArray[i-1];
j=a.lastIndexOf("|");
ri=parseInt(a.substr(j+1,3).replace(/^0*/,""));
r = rtr[ri].cloneNode(true);
r.id = "NewRow" //for convenience in finding all
new ones
b.insertBefore(r, null); //<<<<<<<<<<<this is very slow!
}
It takes about 20 seconds on a 2GHz machine to display the rows.
I would really appreciate any help
Thanks
bruce barker - 11 Dec 2004 01:22 GMT
try firefox, IE can be slow at rendering tables. also 300 rows is a bit much
for IE.
-- bruce (sqlwork.com)
| Client-side problem scripting problem. I have a table of about 300 rows with
| many columns. User chooses to sort on one column. Sort is very fast (I do
[quoted text clipped - 27 lines]
|
| Thanks
Nicole Schenk - 11 Dec 2004 01:27 GMT
> try firefox, IE can be slow at rendering tables. also 300 rows is a bit
> much for IE.
[quoted text clipped - 33 lines]
> |
> | Thanks
Thanks, but that is not an option for me. I have to use IE
Nicole Schenk - 11 Dec 2004 20:00 GMT
> Client-side problem scripting problem. I have a table of about 300 rows
> with many columns. User chooses to sort on one column. Sort is very fast
[quoted text clipped - 27 lines]
>
> Thanks
Problem solved by usin insertBefore after the look. Instead of insertBefore
inside the loop, I use a a document fragment that I create before the loop.
I insert into this fragment.