多个orderBy过滤器(一个是另一个是从控制器固定的)-Angularjs

时间:2016-12-19 06:44:41

标签: angularjs angularjs-filter

我的js功能:

    $scope.sort = function (keyname) {
    $scope.sortKey = keyname;   
    $scope.reverse = !$scope.reverse; 
}

HTML:

      <th ng-click="sort('PaymentID')">
                    <a>Payment ID</a>
                    <span class="glyphicon sort-icon" ng-show="sortKey=='PaymentID'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
                </th>
                <th ng-click="sort('MemberID')"><a>Member ID</a>
                    <span class="glyphicon sort-icon" ng-show="sortKey=='MemberID'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
                </th>
data-dir-paginate="item in data.payment|orderBy:sortKey:reverse|filter:search|itemsPerPage:10">

我有另一个名为'Date'的字段。我只是想通过降序来过滤“日期”(意味着最近添加的付款)。我希望通过降序修改过滤日期,另一个过滤器来自排序功能。 我怎样才能做到这一点? 我尝试了这个,但没有奏效:

 data-dir-paginate="item in data.payment|orderBy:[sortKey,'-Date']:reverse|filter:search|itemsPerPage:10">

0 个答案:

没有答案