diff --git a/frontend/src/Editor/Components/Table/GlobalFilter.jsx b/frontend/src/Editor/Components/Table/GlobalFilter.jsx
new file mode 100644
index 0000000000..015779b110
--- /dev/null
+++ b/frontend/src/Editor/Components/Table/GlobalFilter.jsx
@@ -0,0 +1,53 @@
+import React from 'react';
+// Table Search
+export const GlobalFilter = ({
+ preGlobalFilteredRows,
+ globalFilter,
+ useAsyncDebounce,
+ setGlobalFilter,
+ onComponentOptionChanged,
+ component,
+ serverSideSearch,
+ onEvent,
+}) => {
+ const count = preGlobalFilteredRows.length;
+ const [value, setValue] = React.useState(globalFilter);
+ const onChange = useAsyncDebounce((filterValue) => {
+ setGlobalFilter(filterValue || undefined);
+ }, 200);
+
+ const handleSearchTextChange = (text) => {
+ setValue(text);
+ onChange(text);
+
+ onComponentOptionChanged(component, 'searchText', text).then(() => {
+ if (serverSideSearch === true) {
+ onEvent('onSearch', { component, data: {} });
+ }
+ });
+ };
+
+ return (
+
+ Search:{' '}
+ {
+ handleSearchTextChange(e.target.value);
+ }}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') {
+ handleSearchTextChange(e.target.value);
+ }
+ }}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder={`${count} records`}
+ style={{
+ border: '0',
+ }}
+ />
+
+ );
+};
diff --git a/frontend/src/Editor/Components/Table/Table.jsx b/frontend/src/Editor/Components/Table/Table.jsx
index 7380683c4b..e95dad3004 100644
--- a/frontend/src/Editor/Components/Table/Table.jsx
+++ b/frontend/src/Editor/Components/Table/Table.jsx
@@ -21,9 +21,8 @@ import { Tags } from './Tags';
import { Radio } from './Radio';
import { Toggle } from './Toggle';
import { Datepicker } from './Datepicker';
-
+import { GlobalFilter } from './GlobalFilter';
var _ = require('lodash');
-
export function Table({
id,
width,
@@ -671,47 +670,6 @@ export function Table({
}
}, [state.columnResizing.isResizingColumn]);
- function GlobalFilter() {
- const count = preGlobalFilteredRows.length;
- const [value, setValue] = React.useState(state.globalFilter);
- const onChange = useAsyncDebounce((filterValue) => {
- setGlobalFilter(filterValue || undefined);
- }, 200);
-
- const handleSearchTextChange = (text) => {
- setValue(text);
- onChange(text);
-
- onComponentOptionChanged(component, 'searchText', text).then(() => {
- if (serverSideSearch === true) {
- onEvent('onSearch', { component, data: {} });
- }
- });
- };
-
- return (
-
- Search:{' '}
- {
- handleSearchTextChange(e.target.value);
- }}
- onKeyDown={(e) => {
- if (e.key === 'Enter') {
- handleSearchTextChange(e.target.value);
- }
- }}
- placeholder={`${count} records`}
- style={{
- border: '0',
- }}
- />
-
- );
- }
-
return (
- {displaySearchBox && (
-
-
-
- )}
+
+
+
)}