Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用angularjs对表列进行自定义排序和排序_Angularjs - Fatal编程技术网

使用angularjs对表列进行自定义排序和排序

使用angularjs对表列进行自定义排序和排序,angularjs,Angularjs,尝试对记录优先级列进行排序时,必须根据H-M-L-NO GO和viceversa进行排序。尝试使用,但无法对优先级列执行排序 $scope.filterPriority = function () { if(toggled) { $scope.peoples.sort(function (a, b) { return (priorityArray[a.priority] || Infinity ) - (priorityAr

尝试对记录优先级列进行排序时,必须根据H-M-L-NO GO和viceversa进行排序。尝试使用,但无法对优先级列执行排序

$scope.filterPriority = function () {
        if(toggled) {
            $scope.peoples.sort(function (a, b) {
                return (priorityArray[a.priority] || Infinity ) - (priorityArray[b.priority] || Infinity);
            });
            $scope.sortBy = 'priority';
            $scope.sortDescending = !$scope.sortDescending;
        } else {
            $scope.peoples.sort(function (a, b) {
                return (priorityArray[b.priority] || Infinity ) - (priorityArray[a.priority] || Infinity);
            });
            $scope.sortBy = 'priority';
            $scope.sortDescending = !$scope.sortDescending;
        }   
        toggled = !toggled;
    };
    /* sorting for remaining columns */
    $scope.sortBy = 'name';
    $scope.sortDescending = false;

    $scope.sort = function(column) {
        if ($scope.sortBy === column) {
            $scope.sortDescending = !$scope.sortDescending;
        } else {
            $scope.sortBy = column;
            $scope.sortDescending = false;
        }
    }
我在plunker url中的方法是