igniteui-cli 15.5.1 → 15.6.1
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/avatar/default/files/src/app/__path__/__filePrefix__.tsx +3 -3
- package/templates/react/igr-ts/avatar/default/files/src/app/__path__/style.module.css +9 -0
- package/templates/react/igr-ts/button/default/files/src/app/__path__/__filePrefix__.tsx +1 -1
- package/templates/react/igr-ts/button/default/files/src/app/__path__/style.module.css +3 -0
- package/templates/react/igr-ts/icon/default/files/src/app/__path__/__filePrefix__.tsx +2 -2
- package/templates/react/igr-ts/icon/default/files/src/app/__path__/style.module.css +3 -0
- package/templates/react/igr-ts/icon-button/default/files/src/app/__path__/__filePrefix__.tsx +1 -1
- package/templates/react/igr-ts/icon-button/default/files/src/app/__path__/style.module.css +3 -0
- package/templates/react/igr-ts/pivot-grid/basic/files/src/app/__path__/__filePrefix__.tsx +3 -4
- package/templates/react/igr-ts/projects/_base/files/package.json +1 -0
- 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/avatar/default/files/src/app/__path__/__filePrefix__.ts +7 -2
- package/templates/webcomponents/igc-ts/button/default/files/src/app/__path__/__filePrefix__.ts +8 -3
- package/templates/webcomponents/igc-ts/card/default/files/src/app/__path__/__filePrefix__.ts +3 -1
- package/templates/webcomponents/igc-ts/constants.d.ts +5 -5
- package/templates/webcomponents/igc-ts/constants.js +5 -5
- package/templates/webcomponents/igc-ts/date-time-input/default/files/src/app/__path__/__filePrefix__.ts +8 -2
- package/templates/webcomponents/igc-ts/icon/default/files/src/app/__path__/__filePrefix__.ts +7 -3
- package/templates/webcomponents/igc-ts/icon-button/default/files/src/app/__path__/__filePrefix__.ts +8 -2
- 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/webcomponents/igc-ts/projects/ai-config/files/skills/README.md +1 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/login-bar/login-bar.ts +1 -1
- package/templates/webcomponents/igc-ts/tabs/default/files/src/app/__path__/__filePrefix__.ts +21 -15
- 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
- /package/templates/webcomponents/igc-ts/tabs/default/files/src/app/__path__/{__filePrefix__.test → __filePrefix__.test.ts} +0 -0
|
@@ -1,304 +1,143 @@
|
|
|
1
|
-
# Editing
|
|
1
|
+
# Editing — Cell Editing, Row Editing, Validation
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> For grid setup and column configuration — see [`structure.md`](./structure.md).
|
|
5
|
-
> For programmatic API access — see [`data-operations.md`](./data-operations.md).
|
|
3
|
+
Applies to `IgbGrid`, `IgbTreeGrid`, and `IgbHierarchicalGrid`. **`IgbPivotGrid` is read-only** — never set `Editable` or `RowEditable` on it. **Batch editing does not exist in Blazor** on any grid.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
`PrimaryKey` is required: editing identifies rows by it.
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
- [Cell Editing](#cell-editing)
|
|
11
|
-
- [Row Editing](#row-editing)
|
|
12
|
-
- [Adding & Deleting Rows Programmatically](#adding--deleting-rows-programmatically)
|
|
13
|
-
- [Validation](#validation)
|
|
14
|
-
- [Custom Editors](#custom-editors)
|
|
15
|
-
- [Key Rules](#key-rules)
|
|
7
|
+
## Choosing a mode
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
> **Pivot Grid does not support editing.** The Pivot Grid is read-only. The content below applies to IgbGrid, IgbTreeGrid, and IgbHierarchicalGrid.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Choosing an Editing Mode
|
|
24
|
-
|
|
25
|
-
| Mode | Property | Best For | Commit Behavior |
|
|
9
|
+
| Mode | Enabled by | Commits on | Best for |
|
|
26
10
|
|---|---|---|---|
|
|
27
|
-
| Cell editing | `Editable="true"` on column |
|
|
28
|
-
| Row editing | `RowEditable="true"` on grid |
|
|
29
|
-
|
|
30
|
-
> **Recommendation:** Use **row editing** for most CRUD scenarios. It gives users a clear confirm/cancel flow and prevents partial row updates.
|
|
31
|
-
|
|
32
|
-
---
|
|
11
|
+
| Cell editing | `Editable="true"` on each column | blur, Enter, Tab | quick single-value edits |
|
|
12
|
+
| Row editing | `RowEditable="true"` on the grid | the Done button in the row overlay | multi-field changes — **prefer this for CRUD** |
|
|
33
13
|
|
|
34
|
-
|
|
14
|
+
Row editing gives a clear confirm/cancel flow and prevents half-updated rows. Both modes still need `Editable="true"` on the individual columns.
|
|
35
15
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Mark columns as editable:
|
|
16
|
+
## Cell editing
|
|
39
17
|
|
|
40
18
|
```razor
|
|
41
|
-
<IgbGrid Data="@employees" PrimaryKey="Id" AutoGenerate="false"
|
|
19
|
+
<IgbGrid Data="@employees" PrimaryKey="Id" AutoGenerate="false"
|
|
20
|
+
CellEdit="OnCellEdit" CellEditDone="OnCellEditDone">
|
|
42
21
|
<IgbColumn Field="Id" Header="ID" Editable="false" />
|
|
43
22
|
<IgbColumn Field="Name" Header="Name" Editable="true" DataType="GridColumnDataType.String" />
|
|
44
23
|
<IgbColumn Field="Salary" Header="Salary" Editable="true" DataType="GridColumnDataType.Currency" />
|
|
45
24
|
<IgbColumn Field="HireDate" Header="Hire Date" Editable="true" DataType="GridColumnDataType.Date" />
|
|
46
25
|
<IgbColumn Field="IsActive" Header="Active" Editable="true" DataType="GridColumnDataType.Boolean" />
|
|
47
26
|
</IgbGrid>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
- Double-click (or press Enter on a focused cell) enters edit mode.
|
|
51
|
-
- The editor type is determined by `DataType`: text input for strings, numeric input for numbers, datepicker for dates, checkbox for booleans.
|
|
52
|
-
|
|
53
|
-
### Cell editing events
|
|
54
|
-
|
|
55
|
-
| Event | Type | Description |
|
|
56
|
-
|---|---|---|
|
|
57
|
-
| `CellEditEnter` | `EventCallback<IgbGridEditEventArgs>` | Fires when a cell enters edit mode |
|
|
58
|
-
| `CellEdit` | `EventCallback<IgbGridEditEventArgs>` | Fires before a cell value is committed - set `args.Cancel = true` to reject |
|
|
59
|
-
| `CellEditDone` | `EventCallback<IgbGridEditDoneEventArgs>` | Fires after a cell value is committed |
|
|
60
|
-
| `CellEditExit` | `EventCallback<IgbGridEditDoneEventArgs>` | Fires when a cell exits edit mode |
|
|
61
|
-
|
|
62
|
-
### Example: Validate before commit
|
|
63
|
-
|
|
64
|
-
```razor
|
|
65
|
-
<IgbGrid Data="data" PrimaryKey="Id" CellEdit="OnCellEdit">
|
|
66
|
-
<IgbColumn Field="Salary" Editable="true" DataType="GridColumnDataType.Number" />
|
|
67
|
-
</IgbGrid>
|
|
68
27
|
|
|
69
28
|
@code {
|
|
70
29
|
private void OnCellEdit(IgbGridEditEventArgs args)
|
|
71
30
|
{
|
|
72
|
-
if (args.Column.Field == "Salary")
|
|
31
|
+
if (args.Detail.Column.Field == "Salary" && Convert.ToDecimal(args.Detail.NewValue) < 0)
|
|
73
32
|
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
args.Cancel = true; // reject negative salary
|
|
78
|
-
}
|
|
33
|
+
#pragma warning disable BL0005
|
|
34
|
+
args.Detail.Valid = false; // reject before commit
|
|
35
|
+
#pragma warning restore BL0005
|
|
79
36
|
}
|
|
80
37
|
}
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Example: React to committed changes
|
|
85
|
-
|
|
86
|
-
```razor
|
|
87
|
-
<IgbGrid Data="data" PrimaryKey="Id" CellEditDone="OnCellEditDone">
|
|
88
|
-
...
|
|
89
|
-
</IgbGrid>
|
|
90
38
|
|
|
91
|
-
@code {
|
|
92
39
|
private async Task OnCellEditDone(IgbGridEditDoneEventArgs args)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
// Save to server
|
|
98
|
-
await EmployeeService.UpdateFieldAsync(rowData, field, newValue);
|
|
99
|
-
}
|
|
40
|
+
=> await EmployeeService.UpdateFieldAsync(
|
|
41
|
+
args.Detail.RowData,
|
|
42
|
+
args.Detail.Column.Field,
|
|
43
|
+
args.Detail.NewValue);
|
|
100
44
|
}
|
|
101
45
|
```
|
|
102
46
|
|
|
103
|
-
|
|
47
|
+
Double-click, or Enter on a focused cell, enters edit mode. The editor follows the column's `DataType`: text box, numeric input, date picker, or checkbox.
|
|
104
48
|
|
|
105
|
-
|
|
49
|
+
| Event | Args | Fires |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `CellEditEnter` | `IgbGridEditEventArgs` | entering edit mode |
|
|
52
|
+
| `CellEdit` | `IgbGridEditEventArgs` | before commit — set `args.Detail.Valid = false` to reject |
|
|
53
|
+
| `CellEditDone` | `IgbGridEditDoneEventArgs` | after commit — persist here |
|
|
54
|
+
| `CellEditExit` | `IgbGridEditDoneEventArgs` | leaving edit mode |
|
|
106
55
|
|
|
107
|
-
|
|
56
|
+
## Row editing
|
|
108
57
|
|
|
109
58
|
```razor
|
|
110
|
-
<IgbGrid Data="
|
|
59
|
+
<IgbGrid Data="@projectTasks" PrimaryKey="Id" RowEditable="true" AutoGenerate="false"
|
|
60
|
+
RowEdit="OnRowEdit" RowEditDone="OnRowEditDone">
|
|
111
61
|
<IgbColumn Field="Id" Header="ID" Editable="false" />
|
|
112
62
|
<IgbColumn Field="Name" Header="Name" Editable="true" />
|
|
113
|
-
<IgbColumn Field="
|
|
114
|
-
<IgbColumn Field="
|
|
115
|
-
</IgbGrid>
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
- When `RowEditable="true"`, editing a cell shows a row-level overlay with **Confirm** and **Cancel** buttons.
|
|
119
|
-
- All cells in the row are editable simultaneously.
|
|
120
|
-
- Changes are committed to the data source only on **Confirm**.
|
|
121
|
-
|
|
122
|
-
### Row editing events
|
|
123
|
-
|
|
124
|
-
| Event | Type | Description |
|
|
125
|
-
|---|---|---|
|
|
126
|
-
| `RowEditEnter` | `EventCallback<IgbGridEditEventArgs>` | Fires when a row enters edit mode |
|
|
127
|
-
| `RowEdit` | `EventCallback<IgbGridEditEventArgs>` | Fires before row changes are committed - set `args.Cancel = true` to reject |
|
|
128
|
-
| `RowEditDone` | `EventCallback<IgbGridEditDoneEventArgs>` | Fires after row changes are committed |
|
|
129
|
-
| `RowEditExit` | `EventCallback<IgbGridEditDoneEventArgs>` | Fires when a row exits edit mode |
|
|
130
|
-
|
|
131
|
-
### Example: Save row on confirm
|
|
132
|
-
|
|
133
|
-
```razor
|
|
134
|
-
<IgbGrid Data="data" PrimaryKey="Id" RowEditable="true"
|
|
135
|
-
RowEditDone="OnRowEditDone">
|
|
136
|
-
...
|
|
137
|
-
</IgbGrid>
|
|
138
|
-
|
|
139
|
-
@code {
|
|
140
|
-
private async Task OnRowEditDone(IgbGridEditDoneEventArgs args)
|
|
141
|
-
{
|
|
142
|
-
var updatedRow = args.RowData;
|
|
143
|
-
await EmployeeService.UpdateAsync(updatedRow);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### Row editing with Action Strip
|
|
149
|
-
|
|
150
|
-
Add inline add/edit/delete actions:
|
|
151
|
-
|
|
152
|
-
```razor
|
|
153
|
-
<IgbGrid Data="data" PrimaryKey="Id" RowEditable="true">
|
|
154
|
-
<IgbColumn Field="Name" Editable="true" />
|
|
155
|
-
<IgbColumn Field="Salary" Editable="true" DataType="GridColumnDataType.Number" />
|
|
63
|
+
<IgbColumn Field="StartDate" Header="Start" Editable="true" DataType="GridColumnDataType.Date" />
|
|
64
|
+
<IgbColumn Field="EndDate" Header="End" Editable="true" DataType="GridColumnDataType.Date" />
|
|
156
65
|
<IgbActionStrip>
|
|
157
66
|
<IgbGridEditingActions AddRow="true" />
|
|
158
67
|
</IgbActionStrip>
|
|
159
68
|
</IgbGrid>
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
`IgbGridEditingActions` provides:
|
|
163
|
-
- **Edit** - enters row edit mode on the clicked row
|
|
164
|
-
- **Delete** - removes the row
|
|
165
|
-
- **Add Row** (when `AddRow="true"`) - adds a new empty row above or below
|
|
166
69
|
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
## Adding & Deleting Rows Programmatically
|
|
170
|
-
|
|
171
|
-
### Add a row
|
|
172
|
-
|
|
173
|
-
```razor
|
|
174
70
|
@code {
|
|
175
|
-
private
|
|
71
|
+
private void OnRowEdit(IgbGridEditEventArgs args)
|
|
176
72
|
{
|
|
177
|
-
|
|
178
|
-
{
|
|
179
|
-
Id = employees.Max(e => e.Id) + 1,
|
|
180
|
-
Name = "New Employee",
|
|
181
|
-
Department = "Unassigned",
|
|
182
|
-
Salary = 0
|
|
183
|
-
};
|
|
184
|
-
await grid.AddRowAsync(newEmployee);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Delete a row
|
|
190
|
-
|
|
191
|
-
```razor
|
|
192
|
-
@code {
|
|
193
|
-
private async Task DeleteEmployee(int id)
|
|
73
|
+
if (args.Detail.RowData is ProjectTask task && task.EndDate < task.StartDate)
|
|
194
74
|
{
|
|
195
|
-
|
|
75
|
+
#pragma warning disable BL0005
|
|
76
|
+
args.Detail.Valid = false; // cross-field validation
|
|
77
|
+
#pragma warning restore BL0005
|
|
196
78
|
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private Task OnRowEditDone(IgbGridEditDoneEventArgs args)
|
|
82
|
+
=> ProjectTaskService.UpdateAsync(args.Detail.RowData);
|
|
197
83
|
}
|
|
198
84
|
```
|
|
199
85
|
|
|
200
|
-
|
|
86
|
+
Editing any cell opens a row overlay with Done and Cancel; the whole row is editable at once and nothing reaches the data source until Done. Events mirror the cell ones: `RowEditEnter`, `RowEdit` (cancellable), `RowEditDone`, `RowEditExit`.
|
|
201
87
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
### Custom validation via editing events
|
|
88
|
+
`IgbGridEditingActions` inside an `IgbActionStrip` adds per-row edit, delete, and (with `AddRow="true"`) add buttons.
|
|
205
89
|
|
|
206
|
-
|
|
90
|
+
## Adding and deleting rows from code
|
|
207
91
|
|
|
208
92
|
```razor
|
|
209
|
-
<IgbGrid Data="data" PrimaryKey="Id" RowEditable="true"
|
|
210
|
-
RowEdit="OnRowEdit" CellEdit="OnCellEdit">
|
|
211
|
-
<IgbColumn Field="Name" Editable="true" DataType="GridColumnDataType.String" />
|
|
212
|
-
<IgbColumn Field="Age" Editable="true" DataType="GridColumnDataType.Number" />
|
|
213
|
-
<IgbColumn Field="StartDate" Editable="true" DataType="GridColumnDataType.Date" />
|
|
214
|
-
<IgbColumn Field="EndDate" Editable="true" DataType="GridColumnDataType.Date" />
|
|
215
|
-
</IgbGrid>
|
|
216
|
-
|
|
217
93
|
@code {
|
|
218
|
-
private
|
|
219
|
-
{
|
|
220
|
-
if (args.Column.Field == "Age")
|
|
221
|
-
{
|
|
222
|
-
var newValue = Convert.ToInt32(args.NewValue);
|
|
223
|
-
if (newValue < 18 || newValue > 120)
|
|
224
|
-
{
|
|
225
|
-
args.Cancel = true; // reject out-of-range age
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
94
|
+
private IgbGrid grid = default!;
|
|
229
95
|
|
|
230
|
-
private
|
|
96
|
+
private Task AddEmployee() => grid.AddRowAsync(new Employee
|
|
231
97
|
{
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
98
|
+
Id = employees.Max(e => e.Id) + 1,
|
|
99
|
+
Name = "New Employee",
|
|
100
|
+
Department = "Unassigned"
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
private Task DeleteEmployee(int id) => grid.DeleteRowAsync(id); // primary-key value
|
|
239
104
|
}
|
|
240
105
|
```
|
|
241
106
|
|
|
242
|
-
|
|
107
|
+
## Validation
|
|
243
108
|
|
|
244
|
-
|
|
109
|
+
Validate in `CellEdit` / `RowEdit` and set `args.Detail.Valid = false` to block the commit. Because `Valid` is generated as a component parameter, suppress `BL0005` only around that assignment, as shown above; do not disable it project-wide. In row editing, the row cannot be confirmed while a validation error stands. Show the message with `ErrorTemplate` on the column:
|
|
245
110
|
|
|
246
111
|
```razor
|
|
247
112
|
<IgbColumn Field="Age" Editable="true" DataType="GridColumnDataType.Number">
|
|
248
113
|
<ErrorTemplate>
|
|
249
|
-
|
|
250
|
-
var cell = (IgbCellTemplateContext)context;
|
|
251
|
-
}
|
|
252
|
-
<span style="color: red;">Invalid value</span>
|
|
114
|
+
<span style="color: var(--ig-error-500);">Age must be between 18 and 120</span>
|
|
253
115
|
</ErrorTemplate>
|
|
254
116
|
</IgbColumn>
|
|
255
117
|
```
|
|
256
118
|
|
|
257
|
-
|
|
119
|
+
## Custom editors
|
|
258
120
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
Provide a fully custom edit template for a column:
|
|
121
|
+
`InlineEditorTemplate` replaces the default editor. Bind the input to `cell.Cell.EditValue` — writing to `Cell.Value` bypasses the commit pipeline.
|
|
262
122
|
|
|
263
123
|
```razor
|
|
264
124
|
<IgbColumn Field="Priority" Header="Priority" Editable="true">
|
|
265
125
|
<InlineEditorTemplate>
|
|
266
|
-
@{
|
|
267
|
-
var cell = (IgbCellTemplateContext)context;
|
|
268
|
-
}
|
|
126
|
+
@{ var cell = (IgbCellTemplateContext)context; }
|
|
269
127
|
<IgbSelect @bind-Value="cell.Cell.EditValue">
|
|
270
128
|
<IgbSelectItem Value="Low">Low</IgbSelectItem>
|
|
271
|
-
<IgbSelectItem Value="Medium">Medium</IgbSelectItem>
|
|
272
129
|
<IgbSelectItem Value="High">High</IgbSelectItem>
|
|
273
|
-
<IgbSelectItem Value="Critical">Critical</IgbSelectItem>
|
|
274
130
|
</IgbSelect>
|
|
275
131
|
</InlineEditorTemplate>
|
|
276
132
|
</IgbColumn>
|
|
277
133
|
|
|
278
134
|
<IgbColumn Field="AssignedTo" Header="Assigned To" Editable="true">
|
|
279
135
|
<InlineEditorTemplate>
|
|
280
|
-
@{
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
<IgbCombo TValue="Person"
|
|
284
|
-
Data="people"
|
|
285
|
-
ValueKey="Id"
|
|
286
|
-
DisplayKey="Name"
|
|
287
|
-
SingleSelect="true"
|
|
288
|
-
@bind-Value="cell.Cell.EditValue" />
|
|
136
|
+
@{ var cell = (IgbCellTemplateContext)context; }
|
|
137
|
+
<IgbCombo T="Person" Data="people" ValueKey="Id" DisplayKey="Name"
|
|
138
|
+
SingleSelect="true" @bind-Value="cell.Cell.EditValue" />
|
|
289
139
|
</InlineEditorTemplate>
|
|
290
140
|
</IgbColumn>
|
|
291
141
|
```
|
|
292
142
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
## Key Rules
|
|
296
|
-
|
|
297
|
-
1. **Set `PrimaryKey`** - editing requires a primary key to identify rows.
|
|
298
|
-
2. **`Editable` is on the column, not the grid** - mark each editable column individually.
|
|
299
|
-
3. **`RowEditable` is on the grid** - it enables the row-editing overlay with confirm/cancel.
|
|
300
|
-
4. **Use `CellEdit` / `RowEdit` to cancel edits** - set `args.Cancel = true` before commit.
|
|
301
|
-
5. **Use `CellEditDone` / `RowEditDone` to persist** - these fire after the edit is committed to the grid.
|
|
302
|
-
6. **Validation blocks commit** - in row editing, the row cannot be confirmed while validation errors exist.
|
|
303
|
-
7. **Pivot Grid is read-only** - never set `Editable` or `RowEditable` on an `IgbPivotGrid`.
|
|
304
|
-
8. **Row editing mode is recommended** - it provides the best UX with confirm/cancel and prevents partial updates.
|
|
143
|
+
`IgbCombo`'s generic parameter is **`T`**, not `TValue`.
|