diff --git a/src/components/ReactTable4/BasicTable.js b/src/components/ReactTable4/BasicTable.js
index ddff9ef..3cfbdc9 100644
--- a/src/components/ReactTable4/BasicTable.js
+++ b/src/components/ReactTable4/BasicTable.js
@@ -1,7 +1,7 @@
import React, { useMemo } from "react";
import "./index.scss";
-import { ColumnFilter } from "./ColumnFilter.js";
+import { ColumnSearch } from "./ColumnSearch.js";
import {
useTable,
@@ -24,64 +24,13 @@ import { Settings } from "./Settings";
import { Checkbox } from "./Checkbox";
import MOCK_DATA from "./MOCK_DATA.json";
-// This is a custom filter UI for selecting
-// a unique option from a list
-export function SelectColumnFilter({
- column: { filterValue, setFilter, preFilteredRows, id, render },
-}) {
- const options = React.useMemo(() => {
- const options = new Set();
- preFilteredRows.forEach((row) => {
- options.add(row.values[id]);
- });
- return [...options.values()];
- }, [id, preFilteredRows]);
-
- // Render a multi-select box
- return (
-
- );
-}
-
const BasicTable = ({ settingsIcon }) => {
const columns = React.useMemo(() => COLUMNS, []);
const data = useMemo(() => MOCK_DATA, []);
const defaultColumn = useMemo(() => {
return {
- Filter: ColumnFilter,
+ Filter: ColumnSearch,
};
}, []);
@@ -246,7 +195,18 @@ const BasicTable = ({ settingsIcon }) => {
: " 🔼"
: ""}
-
{column.canFilter ? column.render("Filter") : null}
+
+ ))}
+ {/* {column.canFilter ? column.render("Filter") : null}
*/}
+
+ ))}
+
+
+ {headerGroups.map((headerGroup) => (
+
+ {headerGroup.headers.map((column) => (
+
+ {column.canFilter ? column.render("Filter") : null}
|
))}
@@ -260,6 +220,7 @@ const BasicTable = ({ settingsIcon }) => {
prepareRow(row);
return (
+
{
+export const ColumnSearch = ({ column }) => {
const { filterValue, setFilter } = column;
return (
diff --git a/src/components/ReactTable4/GlobalFilter.js b/src/components/ReactTable4/GlobalFilter.js
index 1aeebd7..9424c8e 100644
--- a/src/components/ReactTable4/GlobalFilter.js
+++ b/src/components/ReactTable4/GlobalFilter.js
@@ -32,6 +32,8 @@ export const GlobalFilter = ({ filter, setFilter }) => {
setFilter(e.target.value)}
+ onFocus={() => setActiveSearchBox(true)}
+ // onBlur={() => setActiveSearchBox(false)}
type="text"
className={`text-xs text-blue-400 rounded focus:outline-none placeholder-blue-400 border`}
style={{ backgroundColor: "#F9FBFF", borderColor: "#B5D6FF" }}
diff --git a/src/components/ReactTable4/SelectColumnFilter.js b/src/components/ReactTable4/SelectColumnFilter.js
new file mode 100644
index 0000000..1e1920a
--- /dev/null
+++ b/src/components/ReactTable4/SelectColumnFilter.js
@@ -0,0 +1,46 @@
+import React from "react";
+
+export const SelectColumnFilter = ({
+ column: { filterValue, setFilter, preFilteredRows, id, render },
+}) => {
+ const options = React.useMemo(() => {
+ const options = new Set();
+ preFilteredRows.forEach((row) => {
+ options.add(row.values[id]);
+ });
+ return [...options.values()];
+ }, [id, preFilteredRows]);
+
+ return (
+
+ );
+};
diff --git a/src/components/ReactTable4/columns.js b/src/components/ReactTable4/columns.js
index 773ac7f..139a7c0 100644
--- a/src/components/ReactTable4/columns.js
+++ b/src/components/ReactTable4/columns.js
@@ -1,13 +1,12 @@
import { format } from "date-fns";
-import Table, { SelectColumnFilter } from "./BasicTable"; // new
-
-import { ColumnFilter } from "./ColumnFilter.js";
+import Table from "./BasicTable"; // new
import { OrderStatus } from "./OrderStatus";
import { OrderLevel } from "./OrderLevel";
import { Buttons } from "./Buttons";
import { EditButtons } from "./EditButtons";
+import { SelectColumnFilter } from "./SelectColumnFilter.js";
export const COLUMNS = [
{