0
votes

How to get the name/id of the sort column and the sort-order of the column in slickgrid?
I'm able to set the sort column using grid.setSortColumn("column"), and would like to get the sort column and it's sort order.

2

2 Answers

3
votes
 grid.getSortColumns()

will give you array of objects like this :

[Object { columnId= "ProjectProgram",  sortAsc=false}]
0
votes

You can access it in the callback function to onSort:

var grid = new Slick.Grid("#sf_grid", dataView, columns, options);

grid.onSort.subscribe(function(e, args) {
    var sortdir = args.sortAsc ? 1 : -1; //get the sort order
    var sortcol = args.sortCol.field;    //get the sort column
});