Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Scripting / December 2004

Tip: Looking for answers? Try searching our database.

Urgent problem, I have a problem with insertBefore - very slow

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nicole Schenk - 11 Dec 2004 00:45 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 (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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.