igniteui-cli 15.5.1 → 15.6.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/package.json +4 -4
- package/templates/blazor/igb/projects/ai-config/files/skills/AGENTS.md +6 -3
- package/templates/blazor/igb/projects/ai-config/files/skills/README.md +30 -45
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/SKILL.md +48 -96
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/charts.md +61 -238
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/data-display.md +60 -193
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/feedback.md +36 -92
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/form-controls.md +66 -224
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/layout-manager.md +39 -88
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/layout.md +75 -152
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/setup.md +40 -149
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-generate-from-image-design/SKILL.md +58 -243
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-generate-from-image-design/references/component-mapping.md +89 -280
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-generate-from-image-design/references/gotchas.md +143 -431
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/SKILL.md +91 -157
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/data-operations.md +50 -228
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/editing.md +61 -222
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/features.md +67 -360
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/grid-migration.md +55 -236
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/paging-remote.md +53 -202
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/sizing.md +31 -232
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/state.md +27 -119
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/structure.md +88 -363
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/types.md +87 -415
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-lite-testing/SKILL.md +8 -4
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-lite-testing/references/interop-contracts.md +42 -6
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-theming/SKILL.md +83 -211
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-theming/references/common-patterns.md +93 -184
- package/templates/react/igr-ts/projects/ai-config/files/skills/README.md +30 -83
- package/templates/react/igr-ts/projects/ai-config/files/skills/grid-lite-to-igr-grid-migration/SKILL.md +98 -191
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/SKILL.md +38 -147
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/COMPONENTS.md +65 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/DATAVIZ.md +90 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/MCP.md +43 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/TROUBLESHOOTING.md +17 -145
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/USAGE.md +85 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-customize-theme/SKILL.md +83 -135
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-customize-theme/reference/CSS-THEMING.md +51 -218
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-generate-from-image-design/SKILL.md +58 -187
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-generate-from-image-design/reference/gotchas.md +55 -154
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-optimize-bundle-size/SKILL.md +48 -401
- package/templates/webcomponents/igc-ts/constants.d.ts +5 -5
- package/templates/webcomponents/igc-ts/constants.js +5 -5
- package/templates/webcomponents/igc-ts/projects/_base/files/package.json +1 -1
- package/templates/webcomponents/igc-ts/projects/_base_with_home/files/package.json +6 -6
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/mcp-setup.md +0 -78
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/mcp-setup.md +0 -78
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-theming/references/mcp-setup.md +0 -81
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/CHARTS-GRIDS.md +0 -398
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/COMPONENT-CATALOGUE.md +0 -161
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/EVENT-HANDLING.md +0 -72
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/INSTALLATION.md +0 -139
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/JSX-PATTERNS.md +0 -187
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/MCP-SERVER.md +0 -77
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/REFS-FORMS.md +0 -232
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-customize-theme/reference/MCP-SERVER.md +0 -67
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-customize-theme/reference/TROUBLESHOOTING.md +0 -35
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-generate-from-image-design/reference/component-mapping.md +0 -132
|
@@ -1,44 +1,18 @@
|
|
|
1
|
-
# Structure
|
|
1
|
+
# Structure — Setup, Columns, Templates, Sorting, Filtering, Selection
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> For specialized grid types (Tree Grid, Hierarchical Grid, Pivot Grid, Grid Lite) — see [`types.md`](./types.md).
|
|
3
|
+
Applies to `IgbGrid`, `IgbTreeGrid`, and `IgbHierarchicalGrid`. Grid Lite and Pivot Grid differ — see [`types.md`](./types.md).
|
|
5
4
|
|
|
6
|
-
##
|
|
7
|
-
|
|
8
|
-
- [Quick Start](#quick-start)
|
|
9
|
-
- [Column Configuration](#column-configuration)
|
|
10
|
-
- [Column Templates](#column-templates)
|
|
11
|
-
- [Column Groups (Multi-Column Headers)](#column-groups-multi-column-headers)
|
|
12
|
-
- [Multi-Row Layout (MRL)](#multi-row-layout-mrl)
|
|
13
|
-
- [Column Pinning](#column-pinning)
|
|
14
|
-
- [Sorting](#sorting)
|
|
15
|
-
- [Filtering](#filtering)
|
|
16
|
-
- [Selection](#selection)
|
|
17
|
-
- [Key Rules](#key-rules)
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Quick Start
|
|
22
|
-
|
|
23
|
-
### 1. Register the module in Program.cs
|
|
5
|
+
## Quick start
|
|
24
6
|
|
|
25
7
|
```csharp
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
// Program.cs
|
|
28
9
|
builder.Services.AddIgniteUIBlazor(typeof(IgbGridModule));
|
|
29
10
|
```
|
|
30
11
|
|
|
31
|
-
### 2. Add `@using` in _Imports.razor
|
|
32
|
-
|
|
33
12
|
```razor
|
|
34
|
-
@using IgniteUI.Blazor.Controls
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### 3. Basic grid markup
|
|
13
|
+
@* _Imports.razor: @using IgniteUI.Blazor.Controls *@
|
|
38
14
|
|
|
39
|
-
|
|
40
|
-
<IgbGrid Data="employees" PrimaryKey="Id" AutoGenerate="false"
|
|
41
|
-
Width="100%" Height="500px">
|
|
15
|
+
<IgbGrid Data="employees" PrimaryKey="Id" AutoGenerate="false" Width="100%" Height="500px">
|
|
42
16
|
<IgbColumn Field="Id" Header="ID" DataType="GridColumnDataType.Number" />
|
|
43
17
|
<IgbColumn Field="Name" Header="Full Name" DataType="GridColumnDataType.String" Sortable="true" />
|
|
44
18
|
<IgbColumn Field="HireDate" Header="Hire Date" DataType="GridColumnDataType.Date" Filterable="true" />
|
|
@@ -48,22 +22,11 @@ builder.Services.AddIgniteUIBlazor(typeof(IgbGridModule));
|
|
|
48
22
|
|
|
49
23
|
@code {
|
|
50
24
|
private List<Employee> employees = new();
|
|
51
|
-
|
|
52
|
-
protected override void OnInitialized()
|
|
53
|
-
{
|
|
54
|
-
employees = EmployeeService.GetAll();
|
|
55
|
-
}
|
|
25
|
+
protected override void OnInitialized() => employees = EmployeeService.GetAll();
|
|
56
26
|
}
|
|
57
27
|
```
|
|
58
28
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```razor
|
|
62
|
-
<IgbGrid Data="employees" PrimaryKey="Id" AutoGenerate="true"
|
|
63
|
-
Width="100%" Height="500px" />
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
When `AutoGenerate="true"`, the grid creates a column for each public property of the data type. You can hook `ColumnInit` to customize columns as they are created, or use `AutoGenerateExclude` to skip specific fields:
|
|
29
|
+
With `AutoGenerate="true"` the grid creates a column per public property. Refine them through `ColumnInit`, or skip fields with `AutoGenerateExclude`:
|
|
67
30
|
|
|
68
31
|
```razor
|
|
69
32
|
<IgbGrid Data="employees" PrimaryKey="Id" AutoGenerate="true"
|
|
@@ -83,419 +46,181 @@ When `AutoGenerate="true"`, the grid creates a column for each public property o
|
|
|
83
46
|
}
|
|
84
47
|
```
|
|
85
48
|
|
|
86
|
-
|
|
49
|
+
## Columns
|
|
87
50
|
|
|
88
|
-
|
|
51
|
+
`GridColumnDataType`: `String`, `Number`, `Boolean`, `Date`, `DateTime`, `Time`, `Currency`, `Percent`, `Image`. It determines the display format, the available filter conditions, the sort comparison, and the default editor — always set it.
|
|
89
52
|
|
|
90
|
-
|
|
53
|
+
| Parameter | Type | Default | Purpose |
|
|
54
|
+
|---|---|---|---|
|
|
55
|
+
| `Field` | `string` | — | Property name on the data object |
|
|
56
|
+
| `Header` | `string` | field name | Header text |
|
|
57
|
+
| `DataType` | `GridColumnDataType` | `String` | Display, sort, filter, edit behavior |
|
|
58
|
+
| `Width` / `MinWidth` / `MaxWidth` | `string` | — | `"200px"`, `"20%"`, or `"auto"` |
|
|
59
|
+
| `Sortable` | `bool` | `false` | Sorting on this column |
|
|
60
|
+
| `Filterable` | `bool` | `true` | Filtering on this column (needs `AllowFiltering` on the grid) |
|
|
61
|
+
| `Editable` | `bool` | `false` | Editing on this column |
|
|
62
|
+
| `Resizable` | `bool` | `false` | User resizing |
|
|
63
|
+
| `Hidden` / `Pinned` | `bool` | `false` | Visibility / pinning |
|
|
64
|
+
| `Groupable` | `bool` | `false` | Grouping — `IgbGrid` only |
|
|
65
|
+
| `HasSummary` | `bool` | `false` | Column summaries |
|
|
66
|
+
| `Selectable` | `bool` | — | Column selection |
|
|
67
|
+
| `DisablePinning` / `DisableHiding` | `bool` | `false` | Remove from the toolbar UI |
|
|
68
|
+
| `CellClasses` / `HeaderClasses` | | — | Conditional CSS classes |
|
|
91
69
|
|
|
92
|
-
|
|
70
|
+
Leave `Width` unset unless the user asks for fixed sizing — see [`sizing.md`](./sizing.md).
|
|
93
71
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
| Number | `GridColumnDataType.Number` | Numeric sorting and filtering |
|
|
98
|
-
| Boolean | `GridColumnDataType.Boolean` | Checkbox display |
|
|
99
|
-
| Date | `GridColumnDataType.Date` | Date picker in edit mode |
|
|
100
|
-
| DateTime | `GridColumnDataType.DateTime` | Date-time picker in edit mode |
|
|
101
|
-
| Currency | `GridColumnDataType.Currency` | Formatted currency display |
|
|
102
|
-
| Percent | `GridColumnDataType.Percent` | Formatted percentage display |
|
|
103
|
-
| Image | `GridColumnDataType.Image` | Renders image from URL |
|
|
104
|
-
|
|
105
|
-
### Key column parameters
|
|
106
|
-
|
|
107
|
-
| Parameter | Type | Default | Description |
|
|
108
|
-
|---|---|---|---|
|
|
109
|
-
| `Field` | `string` | - | Property name on the data object |
|
|
110
|
-
| `Header` | `string` | Field name | Column header text |
|
|
111
|
-
| `DataType` | `GridColumnDataType` | `String` | Data type for display, sort, filter, edit |
|
|
112
|
-
| `Width` | `string` | - | Column width (e.g., `"200px"`, `"20%"`) |
|
|
113
|
-
| `MinWidth` | `string` | - | Minimum column width |
|
|
114
|
-
| `MaxWidth` | `string` | - | Maximum column width |
|
|
115
|
-
| `Sortable` | `bool` | `false` | Enables sorting on this column |
|
|
116
|
-
| `Filterable` | `bool` | `true` | Enables/disables filtering on this column |
|
|
117
|
-
| `Editable` | `bool` | `false` | Enables editing on this column |
|
|
118
|
-
| `Resizable` | `bool` | `false` | Enables column resizing |
|
|
119
|
-
| `Hidden` | `bool` | `false` | Hides the column |
|
|
120
|
-
| `Pinned` | `bool` | `false` | Pins the column |
|
|
121
|
-
| `Groupable` | `bool` | `false` | Enables grouping for this column (IgbGrid only) |
|
|
122
|
-
| `HasSummary` | `bool` | `false` | Enables summaries for this column |
|
|
123
|
-
| `DisablePinning` | `bool` | `false` | Disables pinning for this column |
|
|
124
|
-
| `DisableHiding` | `bool` | `false` | Prevents hiding this column |
|
|
125
|
-
| `CellClasses` | `object` | - | CSS class rules to apply to cells |
|
|
126
|
-
| `HeaderClasses` | `string` | - | CSS class(es) to apply to the header |
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
|
|
130
|
-
## Column Templates
|
|
131
|
-
|
|
132
|
-
### Cell template
|
|
133
|
-
|
|
134
|
-
Use the `BodyTemplate` render fragment to customize the cell display:
|
|
72
|
+
## Templates
|
|
73
|
+
|
|
74
|
+
Templates are Blazor render fragments on `IgbColumn`, and the `context` needs a cast.
|
|
135
75
|
|
|
136
76
|
```razor
|
|
137
|
-
<IgbColumn Field="Salary" Header="Salary" DataType="GridColumnDataType.Currency">
|
|
77
|
+
<IgbColumn Field="Salary" Header="Salary" DataType="GridColumnDataType.Currency" Editable="true">
|
|
138
78
|
<BodyTemplate>
|
|
139
79
|
@{
|
|
140
80
|
var cell = (IgbCellTemplateContext)context;
|
|
141
81
|
var salary = (decimal)cell.Cell.Value;
|
|
142
82
|
}
|
|
143
|
-
<span class="@(salary > 50000 ? "high-salary" : "")">
|
|
144
|
-
@salary.ToString("C")
|
|
145
|
-
</span>
|
|
83
|
+
<span class="@(salary > 50000 ? "high-salary" : "")">@salary.ToString("C")</span>
|
|
146
84
|
</BodyTemplate>
|
|
147
|
-
</IgbColumn>
|
|
148
|
-
```
|
|
149
85
|
|
|
150
|
-
### Header template
|
|
151
|
-
|
|
152
|
-
```razor
|
|
153
|
-
<IgbColumn Field="Name" Header="Name">
|
|
154
86
|
<HeaderTemplate>
|
|
155
87
|
<div style="display: flex; align-items: center; gap: 4px;">
|
|
156
|
-
<IgbIcon
|
|
157
|
-
<span>
|
|
88
|
+
<IgbIcon IconName="payments" Collection="material" />
|
|
89
|
+
<span>Salary</span>
|
|
158
90
|
</div>
|
|
159
91
|
</HeaderTemplate>
|
|
160
|
-
</IgbColumn>
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### Edit template
|
|
164
92
|
|
|
165
|
-
Provide a custom editor for edit mode:
|
|
166
|
-
|
|
167
|
-
```razor
|
|
168
|
-
<IgbColumn Field="Status" Header="Status" Editable="true">
|
|
169
93
|
<InlineEditorTemplate>
|
|
170
|
-
@{
|
|
171
|
-
var cell = (IgbCellTemplateContext)context;
|
|
172
|
-
}
|
|
94
|
+
@{ var cell = (IgbCellTemplateContext)context; }
|
|
173
95
|
<IgbSelect @bind-Value="cell.Cell.EditValue">
|
|
174
96
|
<IgbSelectItem Value="Active">Active</IgbSelectItem>
|
|
175
97
|
<IgbSelectItem Value="Inactive">Inactive</IgbSelectItem>
|
|
176
|
-
<IgbSelectItem Value="Pending">Pending</IgbSelectItem>
|
|
177
98
|
</IgbSelect>
|
|
178
99
|
</InlineEditorTemplate>
|
|
179
100
|
</IgbColumn>
|
|
180
101
|
```
|
|
181
102
|
|
|
182
|
-
|
|
103
|
+
| Fragment | Context type | Reaches |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `BodyTemplate` | `IgbCellTemplateContext` | `cell.Cell.Value`, `cell.Cell.Row.Data` |
|
|
106
|
+
| `HeaderTemplate` | `IgbColumnTemplateContext` | `ctx.Column.Header` |
|
|
107
|
+
| `InlineEditorTemplate` | `IgbCellTemplateContext` | `cell.Cell.EditValue` |
|
|
108
|
+
| `ErrorTemplate` | `IgbCellTemplateContext` | validation message slot |
|
|
183
109
|
|
|
184
|
-
|
|
110
|
+
Inside `IgbIcon`, the parameter is `IconName` — `Name` is the framework element identity, not the glyph.
|
|
185
111
|
|
|
186
|
-
|
|
112
|
+
## Column groups & multi-row layout
|
|
187
113
|
|
|
188
114
|
```razor
|
|
189
|
-
<
|
|
190
|
-
<IgbColumn Field="
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
<IgbColumn Field="LastName" Header="Last Name" />
|
|
194
|
-
<IgbColumn Field="BirthDate" Header="Birth Date" DataType="GridColumnDataType.Date" />
|
|
195
|
-
</IgbColumnGroup>
|
|
196
|
-
<IgbColumnGroup Header="Employment">
|
|
197
|
-
<IgbColumn Field="Department" Header="Department" />
|
|
198
|
-
<IgbColumn Field="HireDate" Header="Hire Date" DataType="GridColumnDataType.Date" />
|
|
199
|
-
<IgbColumn Field="Salary" Header="Salary" DataType="GridColumnDataType.Currency" />
|
|
200
|
-
</IgbColumnGroup>
|
|
201
|
-
</IgbGrid>
|
|
115
|
+
<IgbColumnGroup Header="Personal Info">
|
|
116
|
+
<IgbColumn Field="FirstName" Header="First Name" />
|
|
117
|
+
<IgbColumn Field="LastName" Header="Last Name" />
|
|
118
|
+
</IgbColumnGroup>
|
|
202
119
|
```
|
|
203
120
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## Multi-Row Layout (MRL)
|
|
209
|
-
|
|
210
|
-
Display multiple fields in a single visual row:
|
|
121
|
+
`IgbColumnGroup` nests for multi-level headers. For several fields stacked inside one visual row, use `IgbColumnLayout` and position each column on a sub-grid with `RowStart` / `ColStart` / `RowEnd` / `ColEnd`:
|
|
211
122
|
|
|
212
123
|
```razor
|
|
213
|
-
<
|
|
214
|
-
<
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
</IgbColumnLayout>
|
|
219
|
-
<IgbColumnLayout>
|
|
220
|
-
<IgbColumn Field="City" Header="City" RowStart="1" ColStart="1" />
|
|
221
|
-
<IgbColumn Field="Country" Header="Country" RowStart="1" ColStart="2" />
|
|
222
|
-
<IgbColumn Field="PostalCode" Header="ZIP" RowStart="2" ColStart="1" ColEnd="3" />
|
|
223
|
-
</IgbColumnLayout>
|
|
224
|
-
</IgbGrid>
|
|
124
|
+
<IgbColumnLayout>
|
|
125
|
+
<IgbColumn Field="Name" Header="Name" RowStart="1" ColStart="1" ColEnd="3" />
|
|
126
|
+
<IgbColumn Field="Phone" Header="Phone" RowStart="2" ColStart="1" />
|
|
127
|
+
<IgbColumn Field="Email" Header="Email" RowStart="2" ColStart="2" />
|
|
128
|
+
</IgbColumnLayout>
|
|
225
129
|
```
|
|
226
130
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
## Column Pinning
|
|
232
|
-
|
|
233
|
-
### Declarative pinning
|
|
131
|
+
## Pinning
|
|
234
132
|
|
|
235
133
|
```razor
|
|
236
|
-
<IgbColumn Field="Name"
|
|
134
|
+
<IgbColumn Field="Name" Pinned="true" />
|
|
237
135
|
```
|
|
238
136
|
|
|
239
|
-
### Programmatic pinning
|
|
240
|
-
|
|
241
137
|
```razor
|
|
242
|
-
<IgbGrid @ref="grid" Data="data" PrimaryKey="Id"
|
|
243
|
-
<IgbColumn Field="Id" Header="ID" />
|
|
244
|
-
<IgbColumn Field="Name" Header="Name" />
|
|
245
|
-
</IgbGrid>
|
|
246
|
-
|
|
247
|
-
<IgbButton @onclick="PinNameColumn">Pin Name</IgbButton>
|
|
138
|
+
<IgbGrid @ref="grid" Data="data" PrimaryKey="Id" Pinning="pinningConfig">…</IgbGrid>
|
|
248
139
|
|
|
249
140
|
@code {
|
|
250
141
|
private IgbGrid grid = default!;
|
|
142
|
+
private IgbPinningConfig pinningConfig = new() { Columns = ColumnPinningPosition.End };
|
|
251
143
|
|
|
252
|
-
private
|
|
253
|
-
{
|
|
254
|
-
var col = grid.GetColumnByName("Name");
|
|
255
|
-
col.Pinned = true;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### Pin position
|
|
261
|
-
|
|
262
|
-
Control whether pinned columns appear at the start or end:
|
|
263
|
-
|
|
264
|
-
```razor
|
|
265
|
-
<IgbGrid Data="data" PrimaryKey="Id" Pinning="pinningConfig">
|
|
266
|
-
...
|
|
267
|
-
</IgbGrid>
|
|
268
|
-
|
|
269
|
-
@code {
|
|
270
|
-
private IgbPinningConfig pinningConfig = new IgbPinningConfig
|
|
271
|
-
{
|
|
272
|
-
Columns = ColumnPinningPosition.End
|
|
273
|
-
};
|
|
144
|
+
private void PinName() => grid.GetColumnByName("Name").Pinned = true;
|
|
274
145
|
}
|
|
275
146
|
```
|
|
276
147
|
|
|
277
|
-
---
|
|
278
|
-
|
|
279
148
|
## Sorting
|
|
280
149
|
|
|
281
|
-
### Enable sorting on columns
|
|
282
|
-
|
|
283
150
|
```razor
|
|
284
|
-
<
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
### Grid-level sorting mode
|
|
289
|
-
|
|
290
|
-
| Parameter | Type | Default | Description |
|
|
291
|
-
|---|---|---|---|
|
|
292
|
-
| `SortingOptions` | `IgbSortingOptions` | - | `Mode = SortingOptionsMode.Single` - one column at a time; `Mode = SortingOptionsMode.Multiple` - multi-column sort |
|
|
293
|
-
|
|
294
|
-
```razor
|
|
295
|
-
<IgbGrid Data="data" PrimaryKey="Id" SortingOptions="sortingOptions">
|
|
151
|
+
<IgbGrid Data="data" PrimaryKey="Id"
|
|
152
|
+
SortingOptions="sortingOptions"
|
|
153
|
+
SortingExpressions="sortExpressions"
|
|
154
|
+
SortingDone="OnSortingDone">
|
|
296
155
|
<IgbColumn Field="Department" Sortable="true" />
|
|
297
156
|
<IgbColumn Field="Name" Sortable="true" />
|
|
298
157
|
</IgbGrid>
|
|
299
158
|
|
|
300
159
|
@code {
|
|
301
|
-
private IgbSortingOptions sortingOptions = new
|
|
302
|
-
{
|
|
303
|
-
Mode = SortingOptionsMode.Multiple
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
### Sorting events
|
|
160
|
+
private IgbSortingOptions sortingOptions = new() { Mode = SortingOptionsMode.Multiple };
|
|
309
161
|
|
|
310
|
-
|
|
311
|
-
|---|---|---|
|
|
312
|
-
| `SortingDone` | `EventCallback<IgbSortingExpressionEventArgs>` | Fires after sorting is applied |
|
|
313
|
-
|
|
314
|
-
```razor
|
|
315
|
-
<IgbGrid Data="data" PrimaryKey="Id" SortingDone="OnSortingDone">
|
|
316
|
-
...
|
|
317
|
-
</IgbGrid>
|
|
318
|
-
|
|
319
|
-
@code {
|
|
320
|
-
private void OnSortingDone(IgbSortingExpressionEventArgs args)
|
|
162
|
+
private IgbSortingExpression[] sortExpressions =
|
|
321
163
|
{
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### Pre-set sorting expressions
|
|
328
|
-
|
|
329
|
-
```razor
|
|
330
|
-
<IgbGrid Data="data" PrimaryKey="Id" SortingExpressions="sortExpressions">
|
|
331
|
-
...
|
|
332
|
-
</IgbGrid>
|
|
333
|
-
|
|
334
|
-
@code {
|
|
335
|
-
private IgbSortingExpression[] sortExpressions = new[]
|
|
336
|
-
{
|
|
337
|
-
new IgbSortingExpression
|
|
338
|
-
{
|
|
339
|
-
FieldName = "Name",
|
|
340
|
-
Dir = SortingDirection.Asc
|
|
341
|
-
}
|
|
164
|
+
new() { FieldName = "Name", Dir = SortingDirection.Asc }
|
|
342
165
|
};
|
|
166
|
+
|
|
167
|
+
// args.Detail is IgbSortingExpression[]
|
|
168
|
+
private void OnSortingDone(IgbSortingExpressionEventArgs args) { }
|
|
343
169
|
}
|
|
344
170
|
```
|
|
345
171
|
|
|
346
|
-
|
|
172
|
+
`SortingOptionsMode` is `Single` (default) or `Multiple`. `FieldName` is case-sensitive and must match the C# property exactly.
|
|
347
173
|
|
|
348
174
|
## Filtering
|
|
349
175
|
|
|
350
|
-
### Quick Filter Row
|
|
351
|
-
|
|
352
|
-
The default filter row appears below the header:
|
|
353
|
-
|
|
354
176
|
```razor
|
|
177
|
+
@* Filter row below the header *@
|
|
355
178
|
<IgbGrid Data="data" PrimaryKey="Id" AllowFiltering="true">
|
|
356
179
|
<IgbColumn Field="Name" Filterable="true" DataType="GridColumnDataType.String" />
|
|
357
|
-
<IgbColumn Field="HireDate" Filterable="true" DataType="GridColumnDataType.Date" />
|
|
358
|
-
<IgbColumn Field="Salary" Filterable="true" DataType="GridColumnDataType.Number" />
|
|
359
180
|
</IgbGrid>
|
|
360
|
-
```
|
|
361
181
|
|
|
362
|
-
|
|
182
|
+
@* Excel-style dropdown filters *@
|
|
183
|
+
<IgbGrid Data="data" PrimaryKey="Id" AllowFiltering="true" FilterMode="FilterMode.ExcelStyleFilter">…</IgbGrid>
|
|
363
184
|
|
|
364
|
-
|
|
365
|
-
<IgbGrid Data="data" PrimaryKey="Id"
|
|
366
|
-
AllowFiltering="true"
|
|
367
|
-
FilterMode="FilterMode.ExcelStyleFilter">
|
|
368
|
-
<IgbColumn Field="Department" Filterable="true" />
|
|
369
|
-
<IgbColumn Field="Name" Filterable="true" />
|
|
370
|
-
</IgbGrid>
|
|
185
|
+
@* Query-builder dialog opened from the toolbar *@
|
|
186
|
+
<IgbGrid Data="data" PrimaryKey="Id" AllowAdvancedFiltering="true">…</IgbGrid>
|
|
371
187
|
```
|
|
372
188
|
|
|
373
|
-
|
|
189
|
+
`AllowFiltering` and `AllowAdvancedFiltering` coexist: the filter row stays available while the toolbar button opens the advanced dialog. Available conditions follow the column's `DataType`:
|
|
374
190
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
```razor
|
|
378
|
-
<IgbGrid Data="data" PrimaryKey="Id"
|
|
379
|
-
AllowAdvancedFiltering="true">
|
|
380
|
-
...
|
|
381
|
-
</IgbGrid>
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
> `AllowAdvancedFiltering` and column-level `AllowFiltering` with `FilterMode` can coexist. The toolbar button opens the advanced dialog, while the column-level filter row remains available.
|
|
385
|
-
|
|
386
|
-
### Filtering Conditions
|
|
387
|
-
|
|
388
|
-
The filter condition depends on the column's `DataType`:
|
|
389
|
-
|
|
390
|
-
| Data Type | Available Conditions |
|
|
191
|
+
| Data type | Conditions |
|
|
391
192
|
|---|---|
|
|
392
193
|
| String | Contains, StartsWith, EndsWith, Equals, DoesNotEqual, Empty, NotEmpty |
|
|
393
194
|
| Number | Equals, DoesNotEqual, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, Empty, NotEmpty |
|
|
394
195
|
| Boolean | All, True, False, Empty, NotEmpty |
|
|
395
196
|
| Date | Equals, DoesNotEqual, Before, After, Today, Yesterday, ThisMonth, LastMonth, NextMonth, ThisYear, LastYear, NextYear, Empty, NotEmpty |
|
|
396
197
|
|
|
397
|
-
|
|
198
|
+
Programmatic filtering is in [`data-operations.md`](./data-operations.md).
|
|
398
199
|
|
|
399
200
|
## Selection
|
|
400
201
|
|
|
401
|
-
### Row Selection
|
|
402
|
-
|
|
403
202
|
```razor
|
|
404
|
-
<IgbGrid Data="data" PrimaryKey="Id"
|
|
203
|
+
<IgbGrid @ref="grid" Data="data" PrimaryKey="Id"
|
|
405
204
|
RowSelection="GridSelectionMode.Multiple"
|
|
406
|
-
RowSelectionChanging="OnRowSelection">
|
|
407
|
-
...
|
|
408
|
-
</IgbGrid>
|
|
409
|
-
|
|
410
|
-
@code {
|
|
411
|
-
private void OnRowSelection(IgbRowSelectionEventArgs args)
|
|
412
|
-
{
|
|
413
|
-
var newSelection = args.Detail.NewSelection; // selected row keys
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
| `RowSelection` Value | Behavior |
|
|
419
|
-
|---|---|
|
|
420
|
-
| `GridSelectionMode.None` | No row selection |
|
|
421
|
-
| `GridSelectionMode.Single` | Select one row at a time |
|
|
422
|
-
| `GridSelectionMode.Multiple` | Multi-select with checkboxes |
|
|
423
|
-
| `GridSelectionMode.MultipleCascade` | Multi-select with cascade (Tree Grid: selects children when parent is selected) |
|
|
424
|
-
|
|
425
|
-
### Cell Selection
|
|
426
|
-
|
|
427
|
-
```razor
|
|
428
|
-
<IgbGrid Data="data" PrimaryKey="Id"
|
|
429
205
|
CellSelection="GridSelectionMode.Multiple"
|
|
206
|
+
ColumnSelection="GridSelectionMode.Multiple"
|
|
207
|
+
RowSelectionChanging="OnRowSelection"
|
|
430
208
|
RangeSelected="OnRangeSelected">
|
|
431
|
-
|
|
209
|
+
<IgbColumn Field="Name" Selectable="true" />
|
|
432
210
|
</IgbGrid>
|
|
433
211
|
|
|
434
|
-
@code {
|
|
435
|
-
private void OnRangeSelected(IgbGridSelectionRangeEventArgs args)
|
|
436
|
-
{
|
|
437
|
-
// Handle range selection
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
### Column Selection
|
|
443
|
-
|
|
444
|
-
Enable per-column:
|
|
445
|
-
|
|
446
|
-
```razor
|
|
447
|
-
<IgbColumn Field="Name" Selectable="true" />
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
Or grid-wide:
|
|
451
|
-
|
|
452
|
-
```razor
|
|
453
|
-
<IgbGrid Data="data" PrimaryKey="Id"
|
|
454
|
-
ColumnSelection="GridSelectionMode.Multiple">
|
|
455
|
-
...
|
|
456
|
-
</IgbGrid>
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
### Getting selected rows
|
|
460
|
-
|
|
461
|
-
```razor
|
|
462
212
|
@code {
|
|
463
213
|
private IgbGrid grid = default!;
|
|
464
214
|
|
|
465
|
-
private void
|
|
466
|
-
|
|
467
|
-
var selectedRows = grid.SelectedRows; // object[] of primary key values
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
### Programmatic selection
|
|
473
|
-
|
|
474
|
-
```razor
|
|
475
|
-
@code {
|
|
476
|
-
private IgbGrid grid = default!;
|
|
215
|
+
private void OnRowSelection(IgbRowSelectionEventArgs args)
|
|
216
|
+
=> _ = args.Detail.NewSelection; // primary-key values
|
|
477
217
|
|
|
478
|
-
private
|
|
479
|
-
{
|
|
480
|
-
await grid.SelectRowsAsync(new object[] { 1, 3, 5 }); // select by primary keys
|
|
481
|
-
}
|
|
218
|
+
private void OnRangeSelected(IgbGridSelectionRangeEventArgs args) { }
|
|
482
219
|
|
|
483
|
-
private
|
|
484
|
-
{
|
|
485
|
-
|
|
486
|
-
}
|
|
220
|
+
private void ReadSelection() => _ = grid.SelectedRows; // object[] of primary keys
|
|
221
|
+
private Task SelectSome() => grid.SelectRowsAsync(new object[] { 1, 3, 5 });
|
|
222
|
+
private Task ClearSelection() => grid.DeselectAllRowsAsync();
|
|
487
223
|
}
|
|
488
224
|
```
|
|
489
225
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
## Key Rules
|
|
493
|
-
|
|
494
|
-
1. **Always set `PrimaryKey`** - it is required for selection, editing, and row identity.
|
|
495
|
-
2. **`AutoGenerate="false"` is recommended** - it gives you full control over column order, types, and templates.
|
|
496
|
-
3. **Column `DataType` matters** - it determines the filter conditions, sort behavior, and edit experience. Always set it explicitly.
|
|
497
|
-
4. **Registration is mandatory** - every grid module must be registered in `Program.cs` or the component silently fails to render.
|
|
498
|
-
5. **Use PascalCase for all parameters** - Blazor parameters use PascalCase (`Sortable`, `Filterable`), not kebab-case.
|
|
499
|
-
6. **Data must be a C# collection** - `List<T>`, `T[]`, or `IEnumerable<T>`. Not a JSON string or JavaScript object.
|
|
500
|
-
7. **Use `@ref` for programmatic access** - declare `private IgbGrid grid = default!;` and use `@ref="grid"` on the component.
|
|
501
|
-
8. **Do not add column `Width` unless explicitly requested** - omitting `Width` lets the grid distribute available space proportionally, filling the container with no empty right-side gap. Only set pixel or percentage widths when the user specifically asks for fixed column sizing.
|
|
226
|
+
`GridSelectionMode`: `None`, `Single`, `Multiple`, `MultipleCascade` (Tree Grid — selecting a parent selects its descendants). Selection is keyed by `PrimaryKey`, so it must be set.
|