angular-ui / ui-grid

UI Grid: an Angular Data Grid
http://ui-grid.info
MIT License
5.39k stars 2.47k forks source link

Column Header Menu Options of "Sort Ascending" and "Sort Descending" are always adding to the sort list while header click replaces the existing sort. #5215

Open rmechamatadobe opened 8 years ago

rmechamatadobe commented 8 years ago

Column Header Menu Options of "Sort Ascending" and "Sort Descending" are always adding to the sort fields set while clicking on the header replaces the existing sort field set. Our back can only sort on one field at a time so the click option works great for us but using the sort option from the header menu makes the grid look like it's sorting on multiple values when it's not.

It appears that the ui-grid code is always passing a value of true to the setSetColumn function

    $scope.grid.sortColumn($scope.col, dir, true)
      .then(function () {
        $scope.grid.refresh();
        $scope.hideMenu();
      });
  };

in ui-grid-column-menu.js, I propose to change the code so that some column option option that would define the value that gets passed to this function to determine whether we add to the sort or replace it. I searched around a bit and couldn't find a work around or any docs that describe the functionality I'm after to I apologize in advance if there's a way to achieve my goal. Thank you.

rmechamatadobe commented 8 years ago

I created a pull request for this feature :).

mportuga commented 6 years ago

Here was the original PR if anyone is interested in this feature enhancement: https://github.com/angular-ui/ui-grid/pull/5218