mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-22 00:19:04 +00:00
fix :: bug event not triggering on search (#4156)
This commit is contained in:
parent
e52eb6ddeb
commit
33e37ea4b4
1 changed files with 3 additions and 16 deletions
|
|
@ -10,17 +10,12 @@ export const GlobalFilter = ({
|
|||
}) => {
|
||||
const [value, setValue] = React.useState(globalFilter);
|
||||
const onChange = useAsyncDebounce((filterValue) => {
|
||||
setValue(filterValue);
|
||||
setGlobalFilter(filterValue || undefined);
|
||||
}, 200);
|
||||
|
||||
const handleSearchTextChange = (text) => {
|
||||
setValue(text);
|
||||
onChange(text);
|
||||
|
||||
onComponentOptionChanged(component, 'searchText', text).then(() => {
|
||||
onComponentOptionChanged(component, 'searchText', filterValue).then(() => {
|
||||
onEvent('onSearch', { component, data: {} });
|
||||
});
|
||||
};
|
||||
}, 500);
|
||||
|
||||
return (
|
||||
<div className="ms-2 d-flex border px-2 mx-1 btn-light align-items-center" style={{ padding: '0.25rem 0' }}>
|
||||
|
|
@ -33,14 +28,6 @@ export const GlobalFilter = ({
|
|||
type="text"
|
||||
className="global-search-field btn-light align-self-center"
|
||||
defaultValue={value || ''}
|
||||
onBlur={(e) => {
|
||||
handleSearchTextChange(e.target.value);
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearchTextChange(e.target.value);
|
||||
}
|
||||
}}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
placeholder="Search"
|
||||
style={{
|
||||
|
|
|
|||
Loading…
Reference in a new issue