Search code examples
angularjsangular-ui-gridui-grid

How to get data back from UI - grid after applying filter operation?


I am using Angular Js in my project. To display data and perform search or filter operation, I am using UI-grid. I need the filtered data back to generate a chart and other functionalities. I want to extract only result data or visible data from grid view. How can I do it?


Solution

  • I got the answer.

    var visibledata =scope.gridApi.core.getVisibleRows(scope.gridApi.grid);
    
    var selecteddata = scope.gridApi.selection.getSelectedRows();
    

    And put below code in gridoption.

    onRegisterApi: function(gridApi){
         scope.gridApi = gridApi;
    }