[#130,view/slickgrid] Don't store sort info on state, as it is stored on the query
This commit is contained in:
@@ -135,23 +135,18 @@ my.SlickGrid = Backbone.View.extend({
|
|||||||
this.grid = new Slick.Grid(this.el, data, visibleColumns, options);
|
this.grid = new Slick.Grid(this.el, data, visibleColumns, options);
|
||||||
|
|
||||||
// Column sorting
|
// Column sorting
|
||||||
var sortInfo = this.state.get('columnsSort');
|
var sortInfo = this.model.queryState.get('sort');
|
||||||
if (sortInfo.column){
|
if (sortInfo){
|
||||||
var sortAsc = !(sortInfo.order == 'desc');
|
var column = _.keys(sortInfo[0])[0];
|
||||||
this.grid.setSortColumn(sortInfo.column, sortAsc);
|
var sortAsc = !(sortInfo[0][column].order == 'desc');
|
||||||
|
this.grid.setSortColumn(column, sortAsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.grid.onSort.subscribe(function(e, args){
|
this.grid.onSort.subscribe(function(e, args){
|
||||||
var order = (args.sortAsc) ? 'asc':'desc';
|
var order = (args.sortAsc) ? 'asc':'desc';
|
||||||
self.state.set({columnsSort:{
|
|
||||||
column:args.sortCol.field,
|
|
||||||
order: order
|
|
||||||
}});
|
|
||||||
|
|
||||||
var sort = [{}];
|
var sort = [{}];
|
||||||
sort[0][args.sortCol.field] = {order: order};
|
sort[0][args.sortCol.field] = {order: order};
|
||||||
self.model.query({sort: sort});
|
self.model.query({sort: sort});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.grid.onColumnsReordered.subscribe(function(e, args){
|
this.grid.onColumnsReordered.subscribe(function(e, args){
|
||||||
|
|||||||
Reference in New Issue
Block a user