[#246,bugfix,slickgrid][s]: fix for issue where slickgrid view not presenting columns in order of Dataset Fields - fixes #246.

Bug details: Issue was that sorting of columns was happening inside SlickGrid view even though not supposed to (no special column order had been provided). Specific issue is at following lines 4737d7ecc5/src/view.slickgrid.js (L88):

    // Order them if there is ordering info on the state
    if (this.state.get('columnsOrder')) {

Problem is that state.columnsOrder is the empty array (by default) and in javascript `Boolean([])` is true.
This commit is contained in:
Rufus Pollock 2012-10-14 18:13:13 +01:00
parent 88dfa0b314
commit 75ef00182e

View File

@ -85,7 +85,7 @@ my.SlickGrid = Backbone.View.extend({
});
// Order them if there is ordering info on the state
if (this.state.get('columnsOrder')){
if (this.state.get('columnsOrder') && this.state.get('columnsOrder').length > 0) {
visibleColumns = visibleColumns.sort(function(a,b){
return _.indexOf(self.state.get('columnsOrder'),a.id) > _.indexOf(self.state.get('columnsOrder'),b.id) ? 1 : -1;
});