From 8b632e7db3ccd12ccb4b9d1a5a9f713efe50e168 Mon Sep 17 00:00:00 2001 From: "Ghislain B." Date: Mon, 27 Jan 2025 14:09:39 -0500 Subject: [PATCH] docs: review basic usage docs --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index 7d4b5b77e..b9bb6e65c 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,44 @@ Check out the [Releases](https://github.com/ghiscoding/aurelia-slickgrid/release ### Tested with [Jest](https://jestjs.io/) (Unit Tests) - [Cypress](https://www.cypress.io/) (E2E Tests) Slickgrid-Universal has **100%** Unit Test Coverage and all Aurelia-Slickgrid Examples are tested with [Cypress](https://www.cypress.io/) as E2E tests. + +#### Basic Grid + +```ts +import { type Column, type GridOption } from 'aurelia-slickgrid'; + +export class Example { + columnDefinitions: Column[] = []; + gridOptions: GridOption; + dataset: any[] = []; + + constructor() { + this.columnDefinitions = [ + { id: 'firstName', name: 'First Name', field: 'firstName'}, + { id: 'lastName', name: 'Last Name', field: 'lastName'}, + { id: 'age', name: 'Age', field: 'age' } + ]; + } + + attached() { + this.dataset = [ + { id: 1, firstName: 'John', lastName: 'Doe', age: 20 }, + { id: 2, firstName: 'Jane', lastName: 'Smith', age: 21 } + ]; + this.gridOptions = { /*...*/ }; // optional grid options + } +} +``` + +```html + + +``` + ## Sponsors