How to get Grid API and Column API in AG Grid
In this article, we will show you how to get Grid API and Column API in AG Grid. If you wish to integrate the AG Grid, you might need to perform additional actions using the Grid API or Column API. So here, we’ll walk you through the process of getting the Grid Options.
Checkout more articles on ReactJS
Package Version
Steps to get Grid API and Column API
1. Add AG Grid in React Component
Let’s create a react application using the create-react-app
and implement AG Grid in React. Check the following article for more information.
How to implement AG Grid in React
2. Add an event callback
Now, in order to obtain the grid options, we must add the onGridReady()
event callback. Look at the following code.
1 2 3 4 5 6 7 8 9 10 11 12 | // access API from event object const onGridReady = e => { console.log(‘Event Object:’, e); } //… //… <AgGridReact onGridReady={onGridReady} // register event listener //... /> |
3. Output
In the console window, you will find the grid API and the column API event object that help you to perform grid operations.
That’s it for today.
Thank you for reading. Happy Coding..!! 🙂