I am currently utilizing ag-grid-angular in my Angular application to showcase data. I have a button that is located outside the ag grid, and when it is clicked, I need to retrieve all row data from the grid. I am aware that there is an API available for accomplishing this task. Essentially, what I am trying to do is access the ag grid from my TypeScript file. Below is the code snippet for reference.
Code in the TypeScript file:
this.columns = [
{},
{headerName: 'First Name', field: 'firstName'},
{headerName: 'Last Name', field: 'lastName'}
];
this.rows = [
{"", "first name1", "last name1"},
{"", "first name2", "last name2"}
];
Code in the HTML component:
<ag-grid-angular id="myGrid" #agGrid style="width: 100%" class="ag-theme-balham" [rowData]="rows" [columnDefs]="columns">
</ag-grid-angular>
I would greatly appreciate any guidance on how to achieve this functionality.
Thank you