我正在使用嵌套表 示例数据:
$scope.building =
[
{
"id": 1,
"name": "first",
"ownBlock": [
{
"id": 1,
"name": "Block 1"
},
{
"id": 2,
"name": "Block 2"
}
]
},
{
"id": 2,
"name": "second",
"ownBlock": [
{
"id": 3,
"name": "Block 1"
},
{
"id": 4,
"name": "Block 2"
}
]
}
]
当我对id 2的ownBlock进行排序时,它也会对Id 1的子数据进行排序
<tr ng-repeat="block in data.ownBlock| orderBy : sortColumn.Field : sortColumn.Order">.... </tr>
我知道原因,但我没有办法解决这个问题。希望它有所帮助
答案 0 :(得分:2)
如果您不想要对孩子进行分类,请尝试此
$scope.building = $filter('orderBy')($scope.building,'id');