loicfrering / backbone.datagrid

A powerful component, based on Backbone.View, that displays your Backbone collections in a dynamic datagrid table.
http://loicfrering.github.io/backbone.datagrid/
MIT License
55 stars 14 forks source link

render the table after sorting #19

Open shagi opened 11 years ago

shagi commented 11 years ago

The table was not updated after collection sorting.

Maybe datagrid view should render after any of the collection events, but I bind only to 'sort' to go one test each time :-)

loicfrering commented 11 years ago

I'm not sure that the datagrid should listen to the sort event because if you bypass the datagrid to directly call sort on the collection, the rows sort order will be inconsistent with the sort icons displayed in the header.

What do you think?

shagi commented 11 years ago

OK, I'll try fixing also the header :-)

I think updating the table when the collection is externally sorted is insteresting, as allows easier integration with other views manipulating the data in the collection.

loicfrering commented 11 years ago

Ok, let me know how it goes :+1:

shagi commented 11 years ago

I didn't find a solution to the header, so at least I fixed the bug. I only checked with inMemory collection, but I suppose the other way worked already fine, as remote sorting resets the collection.