Skip to content

Commit 5b5551f

Browse files
authored
Merge pull request #374 from seatable/fix-filter-bugs
refactor: fix editor event handlers
2 parents e24cbcf + d984c70 commit 5b5551f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/DTableFiltersPopover/widgets/filter-item.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,19 +215,17 @@ class FilterItem extends React.Component {
215215
};
216216

217217
onFilterTermCheckboxChanged = () => {
218-
const { filterColumn } = this.props;
219-
const value = this.checkboxEditor.getValue();
220-
const checked = value[filterColumn.key];
221-
this.onFilterTermChanged(checked);
218+
const value = this.checkboxEditor?.getValue();
219+
this.onFilterTermChanged(!!value);
222220
};
223221

224222
onFilterTermTextChanged = (value) => {
225223
this.onFilterTermChanged(value);
226224
};
227225

228226
onFilterTermNumberChanged = () => {
229-
const value = this.numberEditor.getValue();
230-
this.onFilterTermChanged(Object.values(value)[0]);
227+
const value = this.numberEditor?.getValue();
228+
this.onFilterTermChanged(value);
231229
};
232230

233231
onFilterTermDurationChanged = () => {
@@ -278,7 +276,7 @@ class FilterItem extends React.Component {
278276
column={filterColumn}
279277
value={filterTerm}
280278
className='dtable-ui-filter-item-checkbox'
281-
onChange={this.onFilterTermCheckboxChanged}
279+
onCommit={this.onFilterTermCheckboxChanged}
282280
readOnly={readOnly}
283281
/>
284282
</div>
@@ -289,7 +287,7 @@ class FilterItem extends React.Component {
289287
ref={ref => this.numberEditor = ref}
290288
column={filterColumn}
291289
value={filterTerm}
292-
onCommit={this.onFilterTermNumberChanged}
290+
onBlur={this.onFilterTermNumberChanged}
293291
readOnly={readOnly}
294292
/>
295293
);

0 commit comments

Comments
 (0)