Skip to content

Commit b303301

Browse files
committed
Merge branch 'master' of github.com:grid-js/website into master
2 parents a62c8ae + 9c9ecc7 commit b303301

File tree

8 files changed

+1339
-853
lines changed

8 files changed

+1339
-853
lines changed

docs/integrations/angular.md

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
id: angular
3+
title: Angular
4+
---
5+
6+
## Install
7+
8+
```bash
9+
npm install gridjs gridjs-angular
10+
```
11+
12+
## Usage
13+
14+
In your module
15+
16+
```ts
17+
import { GridjsAngularModule } from 'gridjs-angular';
18+
19+
@NgModule({
20+
imports: [CommonModule,GridjsAngularModule],
21+
declarations: [...],
22+
exports: [...],
23+
})
24+
export class AppModule {}
25+
```
26+
27+
In your component template
28+
29+
```ts
30+
import { Component } from "@angular/core";
31+
import { GridJsConfig } from "gridjs-angular";
32+
33+
@Component({
34+
template: `
35+
<gridjs-angular
36+
[gridConfig]="gridConfig"
37+
(cellClick)="handleCellClick($event)"
38+
(rowClick)="handleRowClick($event)"
39+
(beforeLoad)="handleBeforeLoad($event)"
40+
(gridLoad)="handleGridLoad($event)"
41+
></gridjs-angular>
42+
`,
43+
})
44+
class ExampleComponent {
45+
public gridConfig: GridJsConfig = {
46+
columns: ["Name", "Email", "Phone Number"],
47+
data: [
48+
["John", "[email protected]", "(353) 01 222 3333"],
49+
["Mark", "[email protected]", "(01) 22 888 4444"],
50+
["Eoin", "[email protected]", "0097 22 654 00033"],
51+
["Sarah", "[email protected]", "+322 876 1233"],
52+
["Afshin", "[email protected]", "(353) 22 87 8356"],
53+
],
54+
};
55+
56+
handleCellClick(event: any) {
57+
console.log("cellClicked", event);
58+
}
59+
60+
handleRowClick(event: any) {
61+
console.log("rowClicked", event);
62+
}
63+
64+
handleBeforeLoad(event: any) {
65+
console.log("beforeLoad", event);
66+
}
67+
68+
handleGridLoad(event: any) {
69+
console.log("load", event);
70+
}
71+
}
72+
```
73+
74+
Finally don't forget to add gridjs theme in your index.html
75+
76+
```html
77+
<link
78+
href="https://unpkg.com/gridjs/dist/theme/mermaid.min.css"
79+
rel="stylesheet"
80+
/>
81+
```
82+
83+
## Inputs
84+
85+
- You can pass all Grid.js configs to the `<gridjs-angular>` component as inputs. See [Grid.js Config](https://gridjs.io/docs/config) for more details.
86+
87+
- `gridConfig` You can pass Grid.js config as one object and it will be merged with other Grid.js inputs.
88+
89+
- `plugins` Grid.js plugins array. See [Grid.js Plugins](https://gridjs.io/docs/plugin/basics)
90+
91+
## Outputs
92+
93+
- You can pass all Grid.js events as outputs with a little difference `load` event renamed to `beforeLoad`. See [Grid.js Events](https://gridjs.io/docs/examples/event-handler)
94+
95+
### Can I Grid.js rendering helpers? Yes
96+
97+
- Using `h` function is working fine. See this example plugin.
98+
99+
```ts
100+
{
101+
id: 'myplugin',
102+
component: h(() => h('h1', {}, 'Hello world!'), {}),
103+
position: PluginPosition.Header,
104+
}
105+
```
106+
107+
- You can also use `html` in column formatter like this.
108+
109+
```ts
110+
{
111+
name: 'Email',
112+
formatter: (_, row) => html(
113+
`<a href='mailto:${row.cells[1].data}'>${row.cells[1].data}</a>`
114+
)
115+
}
116+
```
117+
118+
### Can I use Angular components in plugins, formatters, etc? Not yet

docs/sponsors.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
id: sponsors
3+
title: Sponsors
4+
---
5+
6+
Grid.js is an open-source, MIT licensed, software and is completely free to use and distribute.
7+
However, the amount of effort needed to maintain and develop Grid.js is not sustainable without your support. Please
8+
consider supporting Grid.js via the following methods.
9+
10+
## OpenCollective
11+
12+
<a href="https://opencollective.com/gridjs/donate" target="_blank">
13+
<img src="https://opencollective.com/gridjs/donate/[email protected]?color=blue" width="300" />
14+
</a>
15+
16+
## One-time donation
17+
18+
<a href="https://www.paypal.me/afshinmeh" target="_blank" rel="noopener">
19+
<img src="/img/paypal.png" width="100" />
20+
</a>

docusaurus.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ module.exports = {
3838
label: 'Examples',
3939
position: 'left'
4040
},
41+
{
42+
to: 'docs/sponsors', label: 'Support Grid.js', position: 'left'
43+
},
4144
{
4245
to: 'docs/community', label: 'Community', position: 'left'
4346
},

0 commit comments

Comments
 (0)