Hi folks,
I have a table which have to sort with expanding and collapsing of row groups. Because this i am using 2D array. The way of DOM selection or some other regions its execution time is bad. I appreciate your response. Table image
$.each(myData, function(index, row) {
$.each(row, function(index1, row2) {
row2.sortKey = findSortKey($(row2).children('td').eq(column));
});
});
$.each(myData, function(index, row) {
row.sort(function(a, b) {
if( !$(a).children('td:first').hasClass('collapse') && !$(a).children('td:first').hasClass('expand') && !$(b).children('td:first').hasClass('collapse') && !$(b).children('td:first').hasClass('expand') ){
return ((a.sortKey < b.sortKey) ? -newDirection : ((a.sortKey > b.sortKey) ? newDirection : 0));
}
if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1){
return -1; // hack for google chromo
}
return 0;
});
});