From ffec750ac37aedd3299396857d87b1cebad61a40 Mon Sep 17 00:00:00 2001 From: Melloware Date: Sat, 2 Sep 2023 07:49:14 -0400 Subject: [PATCH] Fix #4845: Datatable menu filter with singular text field (#4865) --- components/lib/datatable/ColumnFilter.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/lib/datatable/ColumnFilter.js b/components/lib/datatable/ColumnFilter.js index 912e70c87e..f1ca4fc550 100644 --- a/components/lib/datatable/ColumnFilter.js +++ b/components/lib/datatable/ColumnFilter.js @@ -208,11 +208,12 @@ export const ColumnFilter = React.memo((props) => { const onInputChange = (event, index) => { let filters = { ...props.filters }; let value = event.target.value; + let filterField = filters[field]; - if (props.display === 'menu') { - filters[field].constraints[index].value = value; + if (props.display === 'menu' && filterField.constraints) { + filterField.constraints[index].value = value; } else { - filters[field].value = value; + filterField.value = value; } props.onFilterChange(filters);