Initializing multi-column sort via sortInfo broken
(using version 2.0.7)
If you attempt to initialize a multi-column sort via passing sortInfo in the grid options, the sort priority indicators do not appear, and it does not appear to sort in the proper order. I was able to work around this via a plugin:
/* inside gridOptions */
plugins: [{
init: function (scope, grid) {
var sortInfo = [
{ field: 'fieldOne', direction: 'asc' },
{ field: 'fieldTwo', direction: 'desc' }
]
var sortColumns = _.map(sortInfo, function(fieldAndDirection) {
return _.find(scope.columns, function (col) {
if (col.field === fieldAndDirection.field) {
col.sortDirection = fieldAndDirection.direction;
return true;
}
return false;
});
});
grid.sortData(sortColumns);
}
}]
The problem appears to be inside the sortColumnsInit function, where, rather than passing the entire set of columns to sortData, it passes them one at a time. This also may be related to https://github.com/angular-ui/ng-grid/issues/732. It seems strange that we would pass instances of ngColumn in the sortInfo, which should be built on our behalf.
:+1: (btw, haven't tried your workaround -- do you have a jsfiddle for it? Thx!)
Here it is broken; notice that the numeric indicators on the columns aren't there. You can't tell (from the indicators) which column is sorted first.
I'm having trouble getting my workaround to function properly; I'm learning that not all 2.0.7 builds are created equal =(
This appears to be have been fixed in 2.0.8!
Any idea when the next release will be? Thanks for all the awesome work.