@alaarab/ogrid-mcp 2.6.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled-docs/api/README.md +20 -20
- package/bundled-docs/api/components-column-chooser.mdx +1 -1
- package/bundled-docs/api/components-column-header-filter.mdx +1 -1
- package/bundled-docs/api/components-datagrid-table.mdx +1 -1
- package/bundled-docs/api/components-pagination-controls.mdx +1 -1
- package/bundled-docs/api/components-sidebar.mdx +1 -1
- package/bundled-docs/api/components-status-bar.mdx +1 -1
- package/bundled-docs/api/js-api.mdx +2 -2
- package/bundled-docs/features/cell-references.mdx +9 -9
- package/bundled-docs/features/column-chooser.mdx +4 -1
- package/bundled-docs/features/column-groups.mdx +10 -3
- package/bundled-docs/features/column-pinning.mdx +7 -3
- package/bundled-docs/features/column-reordering.mdx +6 -4
- package/bundled-docs/features/column-types.mdx +1 -1
- package/bundled-docs/features/context-menu.mdx +8 -4
- package/bundled-docs/features/csv-export.mdx +7 -7
- package/bundled-docs/features/editing.mdx +21 -21
- package/bundled-docs/features/filtering.mdx +15 -15
- package/bundled-docs/features/formulas.mdx +27 -27
- package/bundled-docs/features/grid-api.mdx +2 -2
- package/bundled-docs/features/keyboard-navigation.mdx +5 -5
- package/bundled-docs/features/pagination.mdx +1 -1
- package/bundled-docs/features/row-selection.mdx +3 -2
- package/bundled-docs/getting-started/overview.mdx +16 -4
- package/bundled-docs/getting-started/quick-start.mdx +11 -11
- package/bundled-docs/getting-started/vanilla-js.mdx +26 -23
- package/bundled-docs/guides/accessibility.mdx +11 -11
- package/bundled-docs/guides/browser-support-matrix.mdx +73 -0
- package/bundled-docs/guides/framework-showcase.mdx +18 -18
- package/bundled-docs/guides/mcp.mdx +9 -9
- package/package.json +1 -1
- package/bundled-docs/features/row-grouping.mdx +0 -313
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
sidebar_position: 5
|
|
3
3
|
title: Framework Showcase
|
|
4
|
-
description: OGrid in React, Angular, Vue, and Vanilla JS —
|
|
4
|
+
description: OGrid in React, Angular, Vue, and Vanilla JS — shared core, native components
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
# Framework Showcase
|
|
9
9
|
|
|
10
|
-
OGrid works with your existing design system
|
|
10
|
+
OGrid works with your existing design system — not against it. React, Angular, Vue, and Vanilla JS are all fully supported, and every framework shares the same headless core so most behavior stays aligned across them.
|
|
11
11
|
|
|
12
|
-
Every grid below is live.
|
|
12
|
+
Every grid below is live. Core interactions like sorting, filtering, editing, and selection are wired up across the demos, and the current browser verification split is documented in the [Browser Support Matrix](./browser-support-matrix).
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -17,11 +17,11 @@ Every grid below is live. Sort, filter, edit, select, copy-paste, undo. It all w
|
|
|
17
17
|
|
|
18
18
|
The short version:
|
|
19
19
|
|
|
20
|
-
- **Starting from scratch?** Pick the Radix variant for your framework
|
|
21
|
-
- **Already using a design system?** Pick the matching package
|
|
20
|
+
- **Starting from scratch?** Pick the Radix variant for your framework — it's the lightest, with no peer dependencies beyond the framework itself.
|
|
21
|
+
- **Already using a design system?** Pick the matching package — Fluent, Material, Angular Material, PrimeNG, Vuetify, or PrimeVue — and the grid components will use your existing components for buttons, inputs, and popovers.
|
|
22
22
|
- **No framework?** Use `@alaarab/ogrid-js` for a full-featured grid with just a CDN import.
|
|
23
23
|
|
|
24
|
-
Switching between UI libraries later is straightforward
|
|
24
|
+
Switching between UI libraries later is straightforward — you change the import and the wrapper provider if required. The grid configuration (columns, data, event handlers) doesn't change.
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
@@ -31,7 +31,7 @@ Three design systems, all sharing the same hooks from `@alaarab/ogrid-react`. Yo
|
|
|
31
31
|
|
|
32
32
|
### Radix UI — lightweight default
|
|
33
33
|
|
|
34
|
-
The default React package. Radix primitives are bundled in
|
|
34
|
+
The default React package. Radix primitives are bundled in — no separate peer dependency to install. It's a good starting point for new projects or when you want minimal overhead.
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
37
|
npm install @alaarab/ogrid-react-radix
|
|
@@ -53,7 +53,7 @@ export default function App() {
|
|
|
53
53
|
|
|
54
54
|
<ShowcaseRadixDemo />
|
|
55
55
|
|
|
56
|
-
### Fluent UI — Microsoft
|
|
56
|
+
### Fluent UI — Microsoft ecosystem
|
|
57
57
|
|
|
58
58
|
If you're building for Microsoft Teams, SharePoint, or any Microsoft 365 integration, Fluent is your pick. The grid uses native Fluent components for headers, filters, and inputs so it blends naturally.
|
|
59
59
|
|
|
@@ -76,7 +76,7 @@ export default function App() {
|
|
|
76
76
|
|
|
77
77
|
### Material UI — Google's Material Design
|
|
78
78
|
|
|
79
|
-
If your app already uses MUI, this drops right in. The grid uses MUI components and respects your `ThemeProvider
|
|
79
|
+
If your app already uses MUI, this drops right in. The grid uses MUI components and respects your `ThemeProvider` — including custom palettes and typography.
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
82
|
npm install @alaarab/ogrid-react-material @mui/material @emotion/react @emotion/styled
|
|
@@ -101,7 +101,7 @@ export default function App() {
|
|
|
101
101
|
|
|
102
102
|
## Angular
|
|
103
103
|
|
|
104
|
-
Signals-based reactivity with standalone components
|
|
104
|
+
Signals-based reactivity with standalone components — no NgModule, no boilerplate. All three packages share the same services from `@alaarab/ogrid-angular`.
|
|
105
105
|
|
|
106
106
|
### Radix (Angular CDK) — lightweight default
|
|
107
107
|
|
|
@@ -137,7 +137,7 @@ npm install @alaarab/ogrid-angular-material @angular/material @angular/cdk
|
|
|
137
137
|
|
|
138
138
|
### PrimeNG
|
|
139
139
|
|
|
140
|
-
For teams
|
|
140
|
+
For teams in the PrimeFaces ecosystem, PrimeNG integration means dialogs, dropdowns, and inputs all look native.
|
|
141
141
|
|
|
142
142
|
```bash
|
|
143
143
|
npm install @alaarab/ogrid-angular-primeng primeng
|
|
@@ -155,7 +155,7 @@ Composition API composables built with `ref()` and `computed()`. All three packa
|
|
|
155
155
|
|
|
156
156
|
### Radix (Headless UI) — lightweight default
|
|
157
157
|
|
|
158
|
-
Headless UI Vue components bundled in
|
|
158
|
+
Headless UI Vue components bundled in — no peer dependencies beyond Vue 3. Good starting point for new Vue projects.
|
|
159
159
|
|
|
160
160
|
```bash
|
|
161
161
|
npm install @alaarab/ogrid-vue-radix
|
|
@@ -204,7 +204,7 @@ npm install @alaarab/ogrid-vue-primevue primevue
|
|
|
204
204
|
|
|
205
205
|
## Vanilla JS / TypeScript
|
|
206
206
|
|
|
207
|
-
No framework, no virtual DOM
|
|
207
|
+
No framework, no virtual DOM — just a container element and a class constructor. A built-in CSS theme covers light and dark mode with CSS custom properties you can override.
|
|
208
208
|
|
|
209
209
|
```bash
|
|
210
210
|
npm install @alaarab/ogrid-js
|
|
@@ -223,7 +223,7 @@ npm install @alaarab/ogrid-js
|
|
|
223
223
|
| **Vue** 3.3+ | Radix (Headless UI) *(bundled)* · Vuetify 3 · PrimeVue 4 | Composition API |
|
|
224
224
|
| **Vanilla JS/TS** | Built-in CSS theme *(zero deps)* | EventEmitter |
|
|
225
225
|
|
|
226
|
-
All 10 packages share the same `@alaarab/ogrid-core
|
|
226
|
+
All 10 packages share the same `@alaarab/ogrid-core`. Shared test factories cover the common contract, and package-specific browser coverage handles the remaining interaction differences. Switching design systems within a framework family is usually a one-line import change.
|
|
227
227
|
|
|
228
228
|
## Premium inputs (optional)
|
|
229
229
|
|
|
@@ -240,7 +240,7 @@ See [Premium Inputs](../features/premium-inputs) for usage and the full list of
|
|
|
240
240
|
|
|
241
241
|
## Related
|
|
242
242
|
|
|
243
|
-
- [Quick Start](../getting-started/quick-start)
|
|
244
|
-
- [Vanilla JS Guide](../getting-started/vanilla-js)
|
|
245
|
-
- [Theming Guide](./theming)
|
|
246
|
-
- [Premium Inputs](../features/premium-inputs)
|
|
243
|
+
- [Quick Start](../getting-started/quick-start) — get a grid running in 60 seconds
|
|
244
|
+
- [Vanilla JS Guide](../getting-started/vanilla-js) — full JS API documentation
|
|
245
|
+
- [Theming Guide](./theming) — customize colors and styling
|
|
246
|
+
- [Premium Inputs](../features/premium-inputs) — advanced cell editors
|
|
@@ -6,7 +6,7 @@ sidebar_position: 1
|
|
|
6
6
|
|
|
7
7
|
# Editor Integration (MCP)
|
|
8
8
|
|
|
9
|
-
`@alaarab/ogrid-mcp` connects your AI coding assistant to OGrid documentation
|
|
9
|
+
`@alaarab/ogrid-mcp` connects your AI coding assistant to OGrid documentation — so instead of switching tabs to look things up, you can just ask your editor while you code.
|
|
10
10
|
|
|
11
11
|
It also includes a **live testing bridge** that lets your editor read and control an OGrid instance running in your browser in real time.
|
|
12
12
|
|
|
@@ -18,7 +18,7 @@ MCP (Model Context Protocol) is a standard that lets editors like Claude Code an
|
|
|
18
18
|
- Pull up specific API references without leaving your editor
|
|
19
19
|
- Inspect and interact with a running grid during development
|
|
20
20
|
|
|
21
|
-
You don't need to understand the protocol to use it
|
|
21
|
+
You don't need to understand the protocol to use it — just run one command and your editor gains access.
|
|
22
22
|
|
|
23
23
|
## Connect to your editor
|
|
24
24
|
|
|
@@ -28,7 +28,7 @@ You don't need to understand the protocol to use it. Run one command and your ed
|
|
|
28
28
|
claude mcp add ogrid -- npx -y @alaarab/ogrid-mcp
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
That's it. The docs are bundled in the package
|
|
31
|
+
That's it. The docs are bundled in the package — no config file needed.
|
|
32
32
|
|
|
33
33
|
### Claude Desktop
|
|
34
34
|
|
|
@@ -72,13 +72,13 @@ Show me how to use the formula engine in Vue.
|
|
|
72
72
|
Help me migrate from AG Grid to OGrid.
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
The MCP server searches through the full documentation
|
|
75
|
+
The MCP server searches through the full documentation — features, API references, getting started guides, and code examples — and returns the relevant sections along with your context.
|
|
76
76
|
|
|
77
77
|
---
|
|
78
78
|
|
|
79
79
|
## Available tools
|
|
80
80
|
|
|
81
|
-
These are what the MCP server provides to your editor. You don't call them directly
|
|
81
|
+
These are what the MCP server provides to your editor. You don't call them directly — your editor uses them automatically when you ask questions.
|
|
82
82
|
|
|
83
83
|
### `search_docs`
|
|
84
84
|
|
|
@@ -89,9 +89,9 @@ search_docs query="server-side data" framework="react"
|
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
Parameters:
|
|
92
|
-
- `query` (required)
|
|
93
|
-
- `framework` (optional)
|
|
94
|
-
- `category` (optional)
|
|
92
|
+
- `query` (required) — what you're looking for
|
|
93
|
+
- `framework` (optional) — `react`, `angular`, `vue`, or `js`
|
|
94
|
+
- `category` (optional) — `features`, `getting-started`, `guides`, or `api`
|
|
95
95
|
|
|
96
96
|
### `list_docs`
|
|
97
97
|
|
|
@@ -133,7 +133,7 @@ Resources can be read by your editor without calling a tool explicitly.
|
|
|
133
133
|
|
|
134
134
|
| Resource | Description |
|
|
135
135
|
|----------|-------------|
|
|
136
|
-
| `ogrid://quick-reference` | Key API overview
|
|
136
|
+
| `ogrid://quick-reference` | Key API overview — props, column definitions, IOGridApi, filter types |
|
|
137
137
|
| `ogrid://docs/{path}` | Any documentation page by path (e.g. `ogrid://docs/features/filtering`) |
|
|
138
138
|
| `ogrid://migration-guide` | Step-by-step guide for migrating from AG Grid to OGrid |
|
|
139
139
|
|
package/package.json
CHANGED
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 12
|
|
3
|
-
title: Row Grouping
|
|
4
|
-
description: Group rows by one or more columns with collapsible group headers
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# Row Grouping
|
|
9
|
-
|
|
10
|
-
Group your data by one or more columns. Each group gets a collapsible header row showing the group value and item count. Multi-level grouping nests groups inside each other.
|
|
11
|
-
|
|
12
|
-
## Basic usage
|
|
13
|
-
|
|
14
|
-
Pass a `groupBy` array with the column IDs you want to group on. Groups start collapsed -- users click the header to expand.
|
|
15
|
-
|
|
16
|
-
<Tabs groupId="framework">
|
|
17
|
-
<TabItem value="react" label="React" default>
|
|
18
|
-
|
|
19
|
-
```tsx
|
|
20
|
-
|
|
21
|
-
const columns = [
|
|
22
|
-
{ columnId: 'name', name: 'Name', sortable: true },
|
|
23
|
-
{ columnId: 'department', name: 'Department', sortable: true },
|
|
24
|
-
{ columnId: 'country', name: 'Country', sortable: true },
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
function App() {
|
|
28
|
-
return (
|
|
29
|
-
<OGrid
|
|
30
|
-
columns={columns}
|
|
31
|
-
data={employees}
|
|
32
|
-
getRowId={(item) => item.id}
|
|
33
|
-
groupBy={['department']}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
:::tip Switching UI libraries
|
|
40
|
-
Same props across all React packages -- just change the import:
|
|
41
|
-
|
|
42
|
-
- **Radix** (lightweight, default): `from '@alaarab/ogrid-react-radix'`
|
|
43
|
-
- **Fluent UI** (Microsoft 365 / SPFx): `from '@alaarab/ogrid-react-fluent'` - wrap in `<FluentProvider>`
|
|
44
|
-
- **Material UI** (MUI v7): `from '@alaarab/ogrid-react-material'` - wrap in `<ThemeProvider>`
|
|
45
|
-
:::
|
|
46
|
-
|
|
47
|
-
</TabItem>
|
|
48
|
-
<TabItem value="angular" label="Angular">
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
|
|
52
|
-
@Component({
|
|
53
|
-
standalone: true,
|
|
54
|
-
imports: [OGridComponent],
|
|
55
|
-
template: `<ogrid [props]="gridProps" />`
|
|
56
|
-
})
|
|
57
|
-
export class GridComponent {
|
|
58
|
-
gridProps = {
|
|
59
|
-
columns: [
|
|
60
|
-
{ columnId: 'name', name: 'Name', sortable: true },
|
|
61
|
-
{ columnId: 'department', name: 'Department', sortable: true },
|
|
62
|
-
{ columnId: 'country', name: 'Country', sortable: true },
|
|
63
|
-
] as IColumnDef<Employee>[],
|
|
64
|
-
data: employees,
|
|
65
|
-
getRowId: (item: Employee) => item.id,
|
|
66
|
-
groupBy: ['department'],
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
:::tip Switching UI libraries
|
|
72
|
-
Same component API across Angular packages. Change the import:
|
|
73
|
-
|
|
74
|
-
- **Radix (CDK)**: `from '@alaarab/ogrid-angular-radix'` *(default, lightweight)*
|
|
75
|
-
- **Angular Material**: `from '@alaarab/ogrid-angular-material'`
|
|
76
|
-
- **PrimeNG**: `from '@alaarab/ogrid-angular-primeng'`
|
|
77
|
-
|
|
78
|
-
All components are standalone, no NgModule required.
|
|
79
|
-
:::
|
|
80
|
-
|
|
81
|
-
</TabItem>
|
|
82
|
-
<TabItem value="vue" label="Vue">
|
|
83
|
-
|
|
84
|
-
```vue
|
|
85
|
-
<script setup lang="ts">
|
|
86
|
-
|
|
87
|
-
const columns: IColumnDef<Employee>[] = [
|
|
88
|
-
{ columnId: 'name', name: 'Name', sortable: true },
|
|
89
|
-
{ columnId: 'department', name: 'Department', sortable: true },
|
|
90
|
-
{ columnId: 'country', name: 'Country', sortable: true },
|
|
91
|
-
];
|
|
92
|
-
|
|
93
|
-
const gridProps = {
|
|
94
|
-
columns,
|
|
95
|
-
data: employees,
|
|
96
|
-
getRowId: (item: Employee) => item.id,
|
|
97
|
-
groupBy: ['department'],
|
|
98
|
-
};
|
|
99
|
-
</script>
|
|
100
|
-
|
|
101
|
-
<template>
|
|
102
|
-
<OGrid :gridProps="gridProps" />
|
|
103
|
-
</template>
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
:::tip Switching UI libraries
|
|
107
|
-
Same API across Vue packages. Change the import:
|
|
108
|
-
|
|
109
|
-
- **Radix (Headless UI)**: `from '@alaarab/ogrid-vue-radix'` *(default, lightweight)*
|
|
110
|
-
- **Vuetify**: `from '@alaarab/ogrid-vue-vuetify'` - wrap in `<v-app>` for theming
|
|
111
|
-
- **PrimeVue**: `from '@alaarab/ogrid-vue-primevue'`
|
|
112
|
-
:::
|
|
113
|
-
|
|
114
|
-
</TabItem>
|
|
115
|
-
<TabItem value="js" label="Vanilla JS">
|
|
116
|
-
|
|
117
|
-
```js
|
|
118
|
-
|
|
119
|
-
const grid = new OGrid(document.getElementById('grid'), {
|
|
120
|
-
columns: [
|
|
121
|
-
{ columnId: 'name', name: 'Name', sortable: true },
|
|
122
|
-
{ columnId: 'department', name: 'Department', sortable: true },
|
|
123
|
-
{ columnId: 'country', name: 'Country', sortable: true },
|
|
124
|
-
],
|
|
125
|
-
data: employees,
|
|
126
|
-
getRowId: (item) => item.id,
|
|
127
|
-
groupBy: ['department'],
|
|
128
|
-
});
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
</TabItem>
|
|
132
|
-
</Tabs>
|
|
133
|
-
|
|
134
|
-
## Multi-level grouping
|
|
135
|
-
|
|
136
|
-
Pass multiple column IDs to create nested groups. The first column is the top-level group, the second is nested within it, and so on.
|
|
137
|
-
|
|
138
|
-
<Tabs groupId="framework">
|
|
139
|
-
<TabItem value="react" label="React" default>
|
|
140
|
-
|
|
141
|
-
```tsx
|
|
142
|
-
<OGrid
|
|
143
|
-
columns={columns}
|
|
144
|
-
data={employees}
|
|
145
|
-
getRowId={(item) => item.id}
|
|
146
|
-
groupBy={['country', 'department']}
|
|
147
|
-
/>
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
</TabItem>
|
|
151
|
-
<TabItem value="angular" label="Angular">
|
|
152
|
-
|
|
153
|
-
```typescript
|
|
154
|
-
gridProps = {
|
|
155
|
-
// ...columns, data, getRowId
|
|
156
|
-
groupBy: ['country', 'department'],
|
|
157
|
-
};
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
</TabItem>
|
|
161
|
-
<TabItem value="vue" label="Vue">
|
|
162
|
-
|
|
163
|
-
```vue
|
|
164
|
-
<script setup>
|
|
165
|
-
const gridProps = {
|
|
166
|
-
// ...columns, data, getRowId
|
|
167
|
-
groupBy: ['country', 'department'],
|
|
168
|
-
};
|
|
169
|
-
</script>
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
</TabItem>
|
|
173
|
-
<TabItem value="js" label="Vanilla JS">
|
|
174
|
-
|
|
175
|
-
```js
|
|
176
|
-
const grid = new OGrid(container, {
|
|
177
|
-
// ...columns, data, getRowId
|
|
178
|
-
groupBy: ['country', 'department'],
|
|
179
|
-
});
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
</TabItem>
|
|
183
|
-
</Tabs>
|
|
184
|
-
|
|
185
|
-
## Programmatic control
|
|
186
|
-
|
|
187
|
-
You can expand, collapse, and toggle groups through the API.
|
|
188
|
-
|
|
189
|
-
<Tabs groupId="framework">
|
|
190
|
-
<TabItem value="react" label="React" default>
|
|
191
|
-
|
|
192
|
-
```tsx
|
|
193
|
-
|
|
194
|
-
function App() {
|
|
195
|
-
const apiRef = useRef<IOGridApi<Employee>>(null);
|
|
196
|
-
|
|
197
|
-
return (
|
|
198
|
-
<>
|
|
199
|
-
<button onClick={() => apiRef.current?.expandAllGroups()}>
|
|
200
|
-
Expand All
|
|
201
|
-
</button>
|
|
202
|
-
<button onClick={() => apiRef.current?.collapseAllGroups()}>
|
|
203
|
-
Collapse All
|
|
204
|
-
</button>
|
|
205
|
-
<OGrid
|
|
206
|
-
ref={apiRef}
|
|
207
|
-
columns={columns}
|
|
208
|
-
data={employees}
|
|
209
|
-
getRowId={(item) => item.id}
|
|
210
|
-
groupBy={['department']}
|
|
211
|
-
/>
|
|
212
|
-
</>
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
</TabItem>
|
|
218
|
-
<TabItem value="angular" label="Angular">
|
|
219
|
-
|
|
220
|
-
```typescript
|
|
221
|
-
@Component({
|
|
222
|
-
standalone: true,
|
|
223
|
-
imports: [OGridComponent],
|
|
224
|
-
template: `
|
|
225
|
-
<button (click)="expandAll()">Expand All</button>
|
|
226
|
-
<button (click)="collapseAll()">Collapse All</button>
|
|
227
|
-
<ogrid [props]="gridProps" />
|
|
228
|
-
`
|
|
229
|
-
})
|
|
230
|
-
export class GridComponent {
|
|
231
|
-
// Use the OGridService or template ref to access the API
|
|
232
|
-
expandAll() { /* apiRef.expandAllGroups() */ }
|
|
233
|
-
collapseAll() { /* apiRef.collapseAllGroups() */ }
|
|
234
|
-
}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
</TabItem>
|
|
238
|
-
<TabItem value="vue" label="Vue">
|
|
239
|
-
|
|
240
|
-
```vue
|
|
241
|
-
<script setup>
|
|
242
|
-
|
|
243
|
-
const ogridRef = ref(null);
|
|
244
|
-
|
|
245
|
-
function expandAll() {
|
|
246
|
-
ogridRef.value?.api?.expandAllGroups();
|
|
247
|
-
}
|
|
248
|
-
function collapseAll() {
|
|
249
|
-
ogridRef.value?.api?.collapseAllGroups();
|
|
250
|
-
}
|
|
251
|
-
</script>
|
|
252
|
-
|
|
253
|
-
<template>
|
|
254
|
-
<button @click="expandAll">Expand All</button>
|
|
255
|
-
<button @click="collapseAll">Collapse All</button>
|
|
256
|
-
<OGrid ref="ogridRef" :gridProps="gridProps" />
|
|
257
|
-
</template>
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
</TabItem>
|
|
261
|
-
<TabItem value="js" label="Vanilla JS">
|
|
262
|
-
|
|
263
|
-
```js
|
|
264
|
-
const grid = new OGrid(container, {
|
|
265
|
-
columns,
|
|
266
|
-
data: employees,
|
|
267
|
-
getRowId: (item) => item.id,
|
|
268
|
-
groupBy: ['department'],
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
// Expand/collapse all
|
|
272
|
-
grid.expandAllGroups();
|
|
273
|
-
grid.collapseAllGroups();
|
|
274
|
-
|
|
275
|
-
// Toggle a specific group
|
|
276
|
-
grid.toggleGroup('department::Engineering');
|
|
277
|
-
|
|
278
|
-
// Change grouping at runtime
|
|
279
|
-
grid.setGroupBy(['country', 'department']);
|
|
280
|
-
|
|
281
|
-
// Clear grouping
|
|
282
|
-
grid.setGroupBy([]);
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
</TabItem>
|
|
286
|
-
</Tabs>
|
|
287
|
-
|
|
288
|
-
## API reference
|
|
289
|
-
|
|
290
|
-
| Prop / Method | Type | Description |
|
|
291
|
-
|---|---|---|
|
|
292
|
-
| `groupBy` | `string[]` | Column IDs to group by. Order matters for nesting. |
|
|
293
|
-
| `setGroupBy(ids)` | method | Change grouping at runtime. Resets expanded state. |
|
|
294
|
-
| `toggleGroup(key)` | method | Toggle a specific group open/closed. |
|
|
295
|
-
| `expandAllGroups()` | method | Expand every group at all nesting levels. |
|
|
296
|
-
| `collapseAllGroups()` | method | Collapse every group. |
|
|
297
|
-
|
|
298
|
-
### Group key format
|
|
299
|
-
|
|
300
|
-
Group keys follow the pattern `columnId::value`. For nested groups, keys are joined with `>`:
|
|
301
|
-
|
|
302
|
-
- Single level: `department::Engineering`
|
|
303
|
-
- Nested: `country::US>department::Engineering`
|
|
304
|
-
|
|
305
|
-
## Styling
|
|
306
|
-
|
|
307
|
-
Group header rows use the `.ogrid-group-header-row` CSS class. Override the background with the `--ogrid-bg-row-group` CSS variable:
|
|
308
|
-
|
|
309
|
-
```css
|
|
310
|
-
:root {
|
|
311
|
-
--ogrid-bg-row-group: #f0f4f8;
|
|
312
|
-
}
|
|
313
|
-
```
|