我正在尝试按嵌套字段分组,但 groupBy 不起作用,它仅适用于主字段。
$scope.groupby = ' ';
$scope.tableParams = new ngTableParams({
page: 1,
count: 10,
sorting: {
name: 'asc'
}
}, {
total: function () {
return $scope.alert.length;
},
groupBy: 'alertRuleCategory.name',
getData: function ($defer, params) {
var orderedData = params.sorting() ? $filter('orderBy')($scope.alert, $scope.tableParams.orderBy()) : $scope.alert;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
警报元素示例
{
name: 'hello',
alertRuleCategory: {
id: 1;name: 'test'
},
id: 5
};
你能帮我找到一些解决方法吗?