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:
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:
Here wij have Three rows of gegevens, with make , monster and price making up the gegevens.
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.
Ok, so now wij know how to define our row and katern gegevens – how do wij define our actual Grid?
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.
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:
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 .