N
Nicole Schenk
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
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