请参阅我的两个问题。
http://plnkr.co/edit/EII4lR5S7P1qUUnuaFJz?p=preview
我正在创建一个不提供列定义列表的网格。默认情况下正在构建列。我需要在一个字段上进行聚合,我正在按照某些人的建议使用registerColumnsProcessor。
onRegisterApi: function(gridApi) {
$scope.gridApi = gridApi;
gridApi.core.registerColumnsProcessor(function (columns) {
columns.forEach(function (column) {
if (column.name == 'age') {
column.aggregationType = uiGridConstants.aggregationTypes.min;
//With this approach I am observing that the aggregationtext is missing from the footer.
//How can I get that?
}
});
return columns;
}, 100);
//alert(gridApi.grid.columns[5].getAggregationValue()); does not work here Cannot read property 'getAggregationValue' of undefined
}
但是我得到的问题是列页脚中缺少aggregateText(min,max,total)。页脚仅显示值。如果连接了弹药,则为20。 我如何实现这一目标?
另一个问题是我想单独检索此聚合值以用于其他用途。我无法得到它。我在poluker示例中添加了一个按钮,从中我可以检索它,但我不想要任何按钮操作。
$scope.showAggregate = function() {
警报($ scope.gridApi.grid.columns [5] .getAggregationValue()); };
我应该使用哪个事件来检索此值。我需要这种方法,因为我将动态生成网格,并且我需要捕获聚合的每个网格。有人可以帮助我吗?