IE Fast rows insertion.

Discussion in 'JavaScript' started by ronen, Mar 20, 2007.

  1. #1
    Hi,
    I need to add dynamically ~1000 rows to a table. I get the rows using AJAX call.

    If I try to insert rows in a convention way (document.createElement for each tbody, tr and td) it takes almost 1.5 min. (Must use IE...)

    I would like to know if there is a way that can append all the rows from the XML directly to the existing table.

    I already tried innerHTML with no success.:confused:
     
    ronen, Mar 20, 2007 IP
  2. cjburkha

    cjburkha Peon

    Messages:
    71
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why doesn't innerHTML work? That was the first solution that poped into my head when reading your post.

    Please see http://www.quirksmode.org/dom/innerhtml.html for the experiment.

    LAWL, I can't link yet ^^
     
    cjburkha, Mar 20, 2007 IP
  3. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Do you have to use tr td? Have you considered using CSS instead?
     
    datropics, Mar 20, 2007 IP
  4. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Do you really NEED to add and DISPLAY all rows at the same time ? Maybe for printing ?
    And, your time problem is adding content of displaying it ?

    If no, a possible workaround is to add row filtering and/or paging (through AJAX)

    Also you can try adding style="table-layout:fixed;" to your table to speed up the rendering time
    .
     
    ajsa52, Mar 21, 2007 IP