JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<script src="http://documentcloud.github.com/backbone/backbone-min.js"></script>
<body></body>
JavaScript
var start = new Date().getTime();
var Row = Backbone.Model.extend();
var RowCollection = Backbone.Collection.extend({
model: Row,
addRows: function() {
for(var i = 0; i < 1000;i++) { this.add({ name: "Cell " + i, date: new Date() }) }
}
});
var rows = new RowCollection();
rows.addRows();
var MyTable = Backbone.View.extend({
initialize: function() {
_.bindAll(this, 'addRow');
},
render: function() {
this.table = $("<table></table>").appendTo("body")
this.model.each(this.addRow);
return this;
},
addRow: function(row) {
this.table.append("<tr><td>"+row.get('name')+"</td><td>"+row.get('date').toString()+"</td></tr>");
}
});
var App = new MyTable({ model: rows });
App.render();
var end = new Date().getTime();
var time = end - start;
alert('Execution time: ' + time);