Expand All

  Getting Started



  Row Models





Github stars make projects look great. Please help, donate a star, it's free.
Get informed on releases and other ag-Grid news only - never spam.
Follow on Twitter


The interface to ag-Grid is modelled around standard DOM elements. This gives ag-Grid a consistent feel to already existing DOM elements (nice for everyone). It also has the added benefit of fitting nicely into Web Components and your framework.

Each interaction with the grid can be broken down into the following categories:

  • Properties: Properties are for changing the state inside the grid. These are analogous to properties on a DOM object.
  • Events: Events are for handling changes from the grid. These are analogous to events in the DOM.
  • Callbacks: Functions that you provide that the grid calls, as a way of modifying behaviour of the grid. This is the grid asking the application a question such as 'what color should this cell be', it is not a means to pass state into or out of the grid.
  • API: API into the grid, to provide features that are not representable via properties and events.

Grid Options

The gridOptions is a 'one stop shop' for the entire interface into the grid. The grid options can be used regardless of the framework you are using, however if you are using React, Angular or Web Components, you can achieve what grid options provides you with in other ways.

The example below shows the different type of items on the gridOptions.

var gridOptions = {

    // PROPERTIES - object properties, myRowData and myColDefs are created somewhere in your application
    rowData: myRowData,
    columnDefs: myColDefs,

    // PROPERTIES - simple boolean / string / number properties
    enableColResize: true,
    rowHeight: 22,
    rowSelection: 'single',

    // EVENTS - add event callback handlers
    onRowClicked: function(event) { console.log('a row was clicked'); },
    onColumnResized: function(event) { console.log('a column was resized'); },
    onGridReady: function(event) { console.log('the grid is now ready'); },

    isScrollLag: function() { return false; }

Once the grid is initialised, then the gridOptions will also have available the grid's api and columnApi as follows:

// get the grid to refresh

// get the grid to space out it's columns

Two Ways of Event Listening

In addition to adding event listeners directly onto the gridOptions, it is possible to register for events, similar to registering for events on native DOM elements. This means there are two ways to listen for events, which again aligns with how DOM elements work. The first is to put an onXXX() method (where XXX = the event name) like in the example above, the second is to register for the event like in the following example:

// create handler function
function myRowClickedHandler(event) {
    console.log('the row was clicked');

// add the handler function
gridOptions.api.addEventListener('rowClicked', myRowClickedHandler);

Default Boolean Properties

Where the property is a boolean (true or false), then false (or leave blank) is the default value. For this reason, on / off items are presented in such was as the most common usage (which will be the default) is false, eg suppressCellSelection is worded as such as most people will want cell selection to be turned on.


The gridOptions are fully available as stated above for Angular. However you can take advantage of Angular's properties and events provided by ag-Grids Angular Component. This is done as follows:

  • Attributes: Attributes are defined as normal HTML attributes and set non-bound values.
  • Properties: Properties are defined as HTML attributes enclosed in square brackets and are Angular bound values.
  • Callbacks: Callbacks are actually a type of property, but by convention they are always functions and are not for relaying event information. They are bound as properties using square brackets. As callbacks are not events, they do not impact the Angular event cycle, and as such should not change the state of anything.
  • Event Handlers: Event handlers are defined as HTML attributes enclosed in normal brackets and are Angular bound functions.
  • API: The grid API and column API are accessible through the component.

All of the above (attributes, properties, callbacks and event handlers) are registered using their 'dash' syntax and not camelcase. For example, the property enableSorting is bound using enable-sorting. enable-sorting. The following example shows some bindings:

        // give an AngularJS 1.x ID to the grid

        // these are boolean values, which if included without a value, default to true
        // (which is different to leaving them out, in which case the default is false)

        // these are attributes, not bound, give explicit values here

        // these are bound properties, bound to the AngularJS 1.x current context (that's what a
        // scope is called in Angular JS 2)

        // this is a callback

        // these are registering event callbacks

The API's are accessible through the component. This is useful in two situations. The first is by using an Angular ID. In the example above, the ID is given as '#myGrid' which then allows something like this:

<button (click)="myGrid.api.deselectAll()">Clear Selection</button>

Next Steps...

And that's it Doc, now you know how to interface with the grid. Go now and find out about all the great attributes, properties, callbacks and events you can use.