我想为我的用户提供仅显示特定列的空值的行的功能。什么是最好的方法? 我提出了这个解决方案,这对我来说很麻烦,重用过滤器输入文本字段:
"onRegisterApi" : function(gridApi){
$scope.gridApi = gridApi;
$scope.gridApi.core.on.filterChanged( $scope, function() {
var grid = this.grid;
var term = grid.columns[7].filters[0].term; // the column I am interested in empty values
if( term == '_' ) {
$log.info("Setting filter to external mode");
$scope.grid.useExternalFiltering = true;
for(var i=0; i< grid.rows.length;i++){
var row = grid.rows[i];
if(row.entity.privileges==null || row.entity.privileges.trim().length==0){
$scope.gridApi.core.clearRowInvisible(row);
}
else{
$scope.gridApi.core.setRowInvisible(row);
}
}
}else if($scope.grid.useExternalFiltering==true){
$log.info("Resetting filter back to internal mode");
$scope.grid.useExternalFiltering = false;
for(var i=0; i< grid.rows.length;i++){
$scope.gridApi.core.clearRowInvisible(grid.rows[i]);
}
}
});
}