angular-ui/ui-grid

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

Open

#5215 aperta il 10 mar 2016

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)JavaScript (2496 fork)batch import
good first issuetype: enhancement

Metriche repository

Star
 (5395 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor