k, that was fun... not. Trying to reply to your message and waiting,
and waiting, and waiting for ThunderChicken to catch up... then do it
again after deleting the large block of text... :)
Any way... my question would be why you are using a string in the first
place?
A possible smarter alternative is to use a DOM object in memory.
Something like this:
var myTable = $("<table></table>");
for (var x = 0; x < json.length; x++) {
var row = $("<tr></tr>");
row.append("<td>my stuff: " + json[x] + "</td>");
myTable.append(row);
}
$(body).append(myTable);
Now, this will do nothing for the sheer volume of data you are dealing
with. But it gets rid of the string and creates DOM objects
immediately. So, the overall processing *should* be a little faster.
The other option is to NOT show so much data, but to introduce paging,
or a smart scroll that will only load data as needed... But dealing
with large volumes are always troublesome. a 7 or 8 second turnaround
isn't tooo bad. I have one page that is closer to 30 seconds (customer
asked for it though - wider date range = more data = more time). The
point is that when large volumes are being dealt with, a delay is
expected. We *should* try to eliminate the delays where we can, but....
HTH
Shawn
wesbird wrote:
Hi
I just start use jQuery about 2 month ago, so please bear with me if
I ask some question which already answered.
I'm working a ajax project, I use JSON to get result from server and
then generate a table on the fly. the problem I have is, my end table
string is huge, length is 935895.
$("#m").html( str ); take
about 7000-8000ms
var m = document.getElementById("m");
m.innerHTML = str; tabke about 2000-3000ms
m is div, str is my test string.
Is there something wrong? How I can improve it?
Thank you very much.