advertisement

Article:
  Dynamic HTML Tables: Improving Performance
Subject:   More tweaks
Date:   2003-07-24 08:29:35
From:   anonymous2
Huberts code is significantly faster. It just solved a big performance problem for me.


This form of code is even neater. It uses the fact that you can use an array as a stack:


var output = new Array();


output.push("<table id='myTable1'><tbody id='myTbody'>");
for (var j = 0; j < tableData.length; j++) {
output.push("<tr class='tr" + (j%2) + "'>");
output.push("<td class='col0'>" + tableData[j].alpha + "</td>");
output.push("<td class='col1'>" + tableData[j].beta + "</td>");
output.push("<td class='col2'>" + tableData[j].gamma + "</td>");
output.push("<td class='col3'>" + tableData[j].delta + "</td>");
output.push("<td class='col4'>" + tableData[j].epsilon + "</td></tr>");
}
output.push("</tbody></table>");
document.getElementById("tableWrap").innerHTML = output.join("");



1 to 1 of 1
  1. More tweaks
    2003-07-31 07:23:54  anonymous2 [View]

1 to 1 of 1