I just started testing out Slickgrid for a project I'm working on and I'm very impressed with its performance. One requirement I have is sorting on multiple columns. I don't fully have my head wrapped around the Dataview in Slickgrid, so maybe I'm missing something obvious, but is there a way to sort a grid on multiple columns? Even if the UI can't handle sorting by more than one, I would like to be able to call a function with the columns in order, plus ascending or descending. I was able to do this with Datatables, but it doesn't have grouping (another requirement for the project).

In the worst case, I will resort to doing the sorting on the server and serving the content back to the client statically sorted.

As far as reflecting the sort order in the UI, while you can't do directly, you can apply the sort indicators by setting "headerCssClass" on the column definitions you're sorting by and having them display the arrows (or however else you're indicating sort columns).

Thanks @tin. This seems to be what I need. But can I sort with just the grid, or do I need to make use of DataView if I want to implement sorting/filtering? I have it displaying with just the grid, but implementing DataView seems like it will involve a lot more work on my part.
–
technomalogicalFeb 9 '11 at 19:04

2

The grid does not manipulate your data. You do. That being said, you don't have to use DataView to sort. Just sort your data and invalidate the grid to reflect the changes in the data. As in: myData.sort(combinedComparer)
–
TinFeb 9 '11 at 19:14

I'm wrestling with the same question at the moment. I need multi-column sorting and filtering, but I haven't implemented DataView. DataView seems to do only single-column sorting, but probably there is a way to override that.
–
FantiusFeb 9 '11 at 19:18

@Fantius - You don't need to use DataView for sorting. Just sort your data directly and invalidate the grid using grid.invalidate().
–
TinFeb 9 '11 at 19:19

I got it working for dataView with multi-column sort in the way. Was the easiest one to understand too. This is from the example in github, except that I've to pass one more parameter for dataView.sort(). It can always be true, and you can take care of the sort direction in your function.