Ag-Grid Reference: Getting Embarked with the JavaScript Datagrid

This section documents how to get began with ag-Grid and JavaScript spil quickly spil possible. You will embark off with a plain application and section by section add Grid features to the application ending up with a fully fledged application with ag-Grid at the heart of it.


You will need the following build contraptions installed at a ondergrens:

  • Git: Please see Git for installation options


To get embarked spil quickly spil possible wij provide a “Seed” repo on Git that you can use. Let’s clone this repo, install the dependencies and embark it up:

# clone the ag-Grid seed project git clone cd ag-grid-seed/javascript # Now either open index.html from the browser of your choice, or from the guideline line: # either Windows: embark index.html # or OSX: open index.html

With those Three directives you should now see the following application:

Excellent! A working Grid application ter no time at all. Let’s pauze down the application into its main parts:

Row Gegevens

At a ondergrens, a Grid requires row gegevens & katern definitions. Row gegevens is provided to the grid spil an array of JavaScript objects:

Here wij have Three rows of gegevens, with make , monster and price making up the gegevens.

Katern Definitions

To display this information wij need to tell the Grid what gegevens wij’re interested ter. Let’s define the three columns that match the gegevens above:

At a ondergrens a katern definition needs a headerName – the katern title to display – and a field – the gegevens voorwerp to read off of from the row gegevens. Here wij’re defining Three columns, Make , Monster and Price , each of which correspond to their lowercase omschrijving te the row gegevens above.

Grid Definition

Ok, so now wij know how to define our row and katern gegevens – how do wij define our actual Grid?

For a JavaScript application, you need to reference ag-Grid ter your html opstopping and provide a container (typically a div for ag-Grid to use:

&lt,html&gt, &lt,head&gt, &lt,!– reference the ag-Grid library–&gt, &lt,script src=””&gt,&lt,/script&gt, &lt,!– our application code –&gt, &lt,script src=””&gt,&lt,/script&gt, &lt,/head&gt, &lt,figure&gt, &lt,h1&gt,Plain ag-Grid Example&lt,/h1&gt, &lt,!– the div ag-Grid will use to render it’s gegevens –&gt, &lt,div id=”myGrid” style=”height: 115px,width:500px” class=”ag-theme-balham”&gt,&lt,/div&gt, &lt,/figure&gt, &lt,/html&gt,

Here wij’re referencing the latest version from the unpkg CDN service. You can use a CDN too, download ag-Grid (see More Details) or bundle it with a implement like Webpack.

Wij’re also providing a div for ag-Grid to use here, along with a width and height. Thesis could be any unit of course, including % .

Ultimately, wij provide a theme for our Grid – the theme determines the Grid’s look and feel. Please see themes for more information.

Next ter our application, wij define a gridOptions object that wij will pass to the Grid – te this wij proclaim the row and katern information wij want displayed:

// Grid Definition // let the grid know which columns and what gegevens to use var gridOptions =

Ultimately, wij wait for the Onverstandig to stream and once ready find the container wij want ag-Grid to use (spil defined by the ID wij provided above) and pass te the GridOptions wij want to use:

The final setup looks like this:

Wij encourage you to proefneming with the plunker above – attempt adding fresh rows of gegevens for example or renaming katern headers.

With this wij have a plain application ready to go of course there is much more wij can do – te the following sections wij will build on this kicking off point.

Adding Features

Ok, excellent – so far so good. But wouldn’t it be nice to be able to sort the gegevens to help us see which car is the most expensive (or least!)?


Adding sorting to our application is very effortless – all you need to do is let the Grid know you want sorting to be enabled by setting a Grid property to true:

With a single property switch wij are now able to sort any katern by clicking the katern header (you can keep clicking and it will cycle through ascending, descending and no sort). Note that ter this example wij’re sorting by Price ter ascending order (indicated by the up arrow):


Our application doesn’t have too many rows, so it’s fairly effortless to find gegevens. But it’s effortless to imagine how a real-world application may have hundreds (or even hundreds of thousands!) or rows, with many columns. Ter a gegevens set like this filtering is your friend.

Spil with sorting, enabling filtering is spil effortless spil setting a single property te our Grid definition:

With the enableFilter property set wij are now able to filterzakje any katern by clicking the katern header “hamburger” to the right of a katern (visible when hovered overheen). Note that te this example wij’re filtering the Monster katern by the text Celica – only the row with Celica is shown now.


Wij’ve only scraped the surface with what you can do with the Grid – please refer to the total set of features on the left arm navigation for an idea of what’s on suggest, but below wij voorstelling a feature rich example:

This example makes use of custom-built cell renderers to vertoning gegevens te a visually friendly way, demonstrates katern grouping spil well spil using JavaScript Components te the header. And even this rich example is only scraping the surface – wij’ve only just gotten embarked with with ag-Grid can do!

Please read the More Details section next to get a deeper understanding of how to use ag-Grid, spil well spil the options ter installing dependencies and accessing the Enterprise Features .

Related movie: Transcend microSDHC Class Ten UHS-I 600x (Ultimate) Unboxing and Read/Write Tests

Leave a Reply