diff --git a/src/views/datagrid.js b/src/views/datagrid.js index 0f9f5b1..c0dc8f8 100644 --- a/src/views/datagrid.js +++ b/src/views/datagrid.js @@ -89,6 +89,7 @@ var Datagrid = Backbone.View.extend({ _sort: function() { if (this.options.inMemory) { this._sortInMemory(); + this.render(); } else { this._sortRequest(); } diff --git a/test/views/datagrid.js b/test/views/datagrid.js index 5c2fe7a..175fd0f 100644 --- a/test/views/datagrid.js +++ b/test/views/datagrid.js @@ -343,6 +343,13 @@ describe('Datagrid', function() { {foo: 'bar2', rank: 'fifth'} ]); }); + + it('shoult update table after sorting', function() { + datagrid.$el.find('thead th:first').html().should.contain('Foo'); + datagrid.$el.find('thead th:first').html().should.not.contain('icon-chevron-up'); + datagrid.sort('foo'); + datagrid.$el.find('thead th:first').html().should.contain('icon-chevron-up'); + }); }); describe('rendering', function() {