in Ag-Grid how to read all pages specific cell data and store into array

1.2k views Asked by At
    export class AppComponent {
    
      gridApi: any;
      columnApi: any;
    
      title = 'AgGridPro';
    
      constructor(private httpClient : HttpClient){
    
      }
    
      column = [
        {
          "headerName": "Name",
          "field": "name",
          sortable: true,
          editable: true
        },
        {
          "headerName": "Mobile",
          "field": "mobile"
        },
        {
          "headerName": "Age",
          "field": "age"
        },
        {
          field: 'age',
          minWidth: 120,
          aggFunc: 'sum',
        },
        {
          "headerName": "Address",
          "field": "Address"
        }
      ]

 onGridReady(params: any) {
    this.gridApi = params.api;
    this.columnApi = params.columnApi;



  }
    }

in above code we have 200 rows data and 8 pages but if tried with griApi we are only able to read 1 page of 25 records only not able to read another page data want to get the list of records from row names and stored into new array if anyone of the name is empty need to create error for that records so need to store that list of empty cell name data into array

1

There are 1 answers

0
Shuheb On BEST ANSWER

You can iterate through all the row data by using the grid api method forEachNode:

https://www.ag-grid.com/javascript-data-grid/grid-api/

forEachNode

Iterates through each node (row) in the grid and calls the callback for each node. This works similar to the forEach method on a JavaScript array. This is called for every node, ignoring any filtering or sorting applied within the grid. If using the Infinite Row Model, then this gets called for each page loaded in the page cache.

function forEachNode( callback: (rowNode: RowNode, index: number) => void ): void;