When I click a sortable column title it first sorts descending and on second click it's ascending. How can I reverse that?
I'm aware that you can set initial sorting order in settings, but I need to change default behavior of clicking on columns.
There is no way to configure ng-table in order to set ascending order first without changing the source code.
In ngTableSorterRowController.js you can read this:
var defaultSort = $scope.params.settings().defaultSort;
var inverseSort = (defaultSort === 'asc' ? 'desc' : 'asc');
var sorting = $scope.params.sorting() && $scope.params.sorting()[parsedSortable] && ($scope.params.sorting()[parsedSortable] === defaultSort);
var sortingParams = (event.ctrlKey || event.metaKey) ? $scope.params.sorting() : {};
sortingParams[parsedSortable] = (sorting ? inverseSort : defaultSort);
$scope.params.parameters({
sorting: sortingParams
});
I think that (sorting ? inverseSort : defaultSort);
is the code responsible of the ascending-first ordering behavior.