Skip to content

Commit 77f4128

Browse files
committed
Fix change event in state samples
1 parent 1fc7611 commit 77f4128

2 files changed

Lines changed: 29 additions & 32 deletions

File tree

  • samples/grids
    • hierarchical-grid/state-persistence-main/src
    • tree-grid/state-persistence-main/src

samples/grids/hierarchical-grid/state-persistence-main/src/index.tsx

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import ReactDOM from "react-dom/client";
44
import {
55
FilterMode,
66
IgrActionStrip,
7-
IgrGrid,
87
IgrColumn,
98
IgrGridModule,
109
IgrGridPinningActions,
@@ -23,7 +22,7 @@ import {
2322
IgrButton,
2423
IgrCheckbox,
2524
IgrCheckboxModule,
26-
IgrComponentBoolValueChangedEventArgs,
25+
IgrCheckboxChangeEventArgs,
2726
IgrIcon,
2827
IgrIconModule,
2928
} from "igniteui-react";
@@ -113,26 +112,26 @@ export default function App() {
113112
grid.clearCellSelection();
114113
}
115114

116-
function onChange(s: IgrCheckbox, e: IgrComponentBoolValueChangedEventArgs) {
115+
function onChange(s: IgrCheckbox, e: IgrCheckboxChangeEventArgs) {
117116
if (s.name === "allFeatures") {
118117
setOption({
119-
cellSelection: e.detail,
120-
rowSelection: e.detail,
121-
filtering: e.detail,
122-
advancedFiltering: e.detail,
123-
paging: e.detail,
124-
sorting: e.detail,
125-
columns: e.detail,
126-
expansion: e.detail,
127-
rowPinning: e.detail,
128-
columnSelection: e.detail,
129-
rowIslands: e.detail,
118+
cellSelection: e.detail.checked,
119+
rowSelection: e.detail.checked,
120+
filtering: e.detail.checked,
121+
advancedFiltering: e.detail.checked,
122+
paging: e.detail.checked,
123+
sorting: e.detail.checked,
124+
columns: e.detail.checked,
125+
expansion: e.detail.checked,
126+
rowPinning: e.detail.checked,
127+
columnSelection: e.detail.checked,
128+
rowIslands: e.detail.checked,
130129
});
131130
for (const key of Object.keys(options)) {
132-
gridStateRef.current.options[key] = e.detail;
131+
gridStateRef.current.options[key] = e.detail.checked;
133132
}
134133
} else {
135-
gridStateRef.current.options[s.name] = e.detail;
134+
gridStateRef.current.options[s.name] = e.detail.checked;
136135
}
137136
}
138137

samples/grids/tree-grid/state-persistence-main/src/index.tsx

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ import {
1515
IgrGridState,
1616
IgrGridStateOptions,
1717
GridSelectionMode,
18-
IgrHierarchicalGrid,
19-
IgrRowIsland,
2018
IgrTreeGrid,
2119
} from "igniteui-react-grids";
2220
import {
2321
IgrButton,
2422
IgrCheckbox,
2523
IgrCheckboxModule,
26-
IgrComponentBoolValueChangedEventArgs,
24+
IgrCheckboxChangeEventArgs,
2725
IgrIcon,
2826
IgrIconModule,
2927
} from "igniteui-react";
@@ -112,25 +110,25 @@ export default function App() {
112110
grid.clearCellSelection();
113111
}
114112

115-
function onChange(s: IgrCheckbox, e: IgrComponentBoolValueChangedEventArgs) {
113+
function onChange(s: IgrCheckbox, e: IgrCheckboxChangeEventArgs) {
116114
if (s.name === "allFeatures") {
117115
setOption({
118-
cellSelection: e.detail,
119-
rowSelection: e.detail,
120-
filtering: e.detail,
121-
advancedFiltering: e.detail,
122-
paging: e.detail,
123-
sorting: e.detail,
124-
columns: e.detail,
125-
expansion: e.detail,
126-
rowPinning: e.detail,
127-
columnSelection: e.detail,
116+
cellSelection: e.detail.checked,
117+
rowSelection: e.detail.checked,
118+
filtering: e.detail.checked,
119+
advancedFiltering: e.detail.checked,
120+
paging: e.detail.checked,
121+
sorting: e.detail.checked,
122+
columns: e.detail.checked,
123+
expansion: e.detail.checked,
124+
rowPinning: e.detail.checked,
125+
columnSelection: e.detail.checked,
128126
});
129127
for (const key of Object.keys(options)) {
130-
gridStateRef.current.options[key] = e.detail;
128+
gridStateRef.current.options[key] = e.detail.checked;
131129
}
132130
} else {
133-
gridStateRef.current.options[s.name] = e.detail;
131+
gridStateRef.current.options[s.name] = e.detail.checked;
134132
}
135133
}
136134

0 commit comments

Comments
 (0)