Permalink
Browse files

Only append a row at a time. (handles larger datasets better)

  • Loading branch information...
Robert Jackson
Robert Jackson committed Mar 29, 2012
1 parent a8450d0 commit eb9a892ee83e43f3dba9bb477f4b77934dbfba1f
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/javascripts/pivot_demo.js
@@ -91,25 +91,29 @@ PivotDemo.prototype.update_results = function(){
columns.push(fieldName);
};
- result_table = $('#results');
+ var result_table = $('#results'),
+ result_rows;
result_table.empty();
snip += '<table class="table table-striped table-condensed"><thead><tr>';
$.each(columns, function(index, fieldName){
- snip += '<td>' + fieldName + '</td>';
+ snip += '<th>' + fieldName + '</th>';
});
- snip += '</thead></tr>';
+ snip += '</thead></tr><tbody id="result-rows"></tbody></table>';
+ result_table.append(snip);
+
+ result_rows = $('#result-rows');
$.each(pivot.results(),function(index, row){
snip = '<tr>';
$.each(columns, function(index, fieldName){
snip += '<td>' + row[fieldName] + '</td>';
});
snip += '</tr>';
+
+ result_rows.append(snip);
});
- snip += '</table>';
- result_table.append(snip);
};
PivotDemo.prototype.update_filtered_rows = function(){

0 comments on commit eb9a892

Please sign in to comment.