IWI
IWI

Reputation: 1608

Angular UI-grid how many rows are visible?

In Angular UI-Grid, is there any way to tell how many rows are visible in my grid? For example, if I have 5,000 rows, and then I filter, and am left with 2,500 rows, is there a way to check that through the gridApi?

Upvotes: 0

Views: 653

Answers (1)

jcc
jcc

Reputation: 1147

Do you have an example of what you have tried? If you haven't incorporated the footer elements yet, start there.

http://ui-grid.info/docs/#/tutorial/105_footer

$scope.gridOptions = {
    showGridFooter: true,
    showColumnFooter: true,
    enableFiltering: true,
    columnDefs: [
        { field: 'name', width: '13%' },
        { name: 'registered', field: 'registered', width: '20%', cellFilter: 'date', footerCellFilter: 'date', aggregationType: uiGridConstants.aggregationTypes.max }
    ],
    data: data,
    onRegisterApi: function(gridApi) {
        $scope.gridApi = gridApi;
    }
};

$scope.toggleFooter = function() {
    $scope.gridOptions.showGridFooter = !$scope.gridOptions.showGridFooter;
    $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.OPTIONS);
};

You can even create footers for each column to aggregate any data present.

Upvotes: 1

Related Questions