efficient way to parse table to array object in IE
im having table with more than 1k rows and more than 7 columns, trying to parse into array object, i tried using jquery
$(tableSearch).each(function () {
$('tr', $(this)).each(function (key, tr) {
开发者_开发问答 var self = this;
var obj = new Object();
var rowPos = 0;
$('td', tr).each(function (rowPos) {
obj[_self.colModel[rowPos].name] = $(this).html();
});
obj['Key'] = 'Rec-' + key;
});
});
in FF it takes 300 milli seconds, but in IE its taking 60 seconds :(
as u can compare its around 200 times slower.
is there any way to get performance in IE. i tried raw javascript methods also still in IE efficiency is not achieved.
help me!!!!!!!.. how can i get similar performance in all browsers.
THANKS in Advance
i got the solution IE can be faster if we implemented this way
table = document.getElementById("myGrid");
for (i = 0; i < table.rows.length; i += 1) {
var rowData = new Array();
row = table.rows[i];
for (j = 0; j < row.cells.length; j += 1) {
cell = row.cells[j];
rowData[j] = cell.innerHtml
}
obj.push(rowData);
}
Note: disable debug mode if ur using any debugger.
then IE seems to be reasonable but cant be faster than FF or safari
精彩评论