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

#5,215 创建于 2016年3月10日

在 GitHub 查看
 (2 评论) (0 反应) (0 负责人)JavaScript (5,395 star) (2,496 fork)batch import
good first issuetype: enhancement

描述

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.

贡献者指南