diff --git a/src/Views/Components/ListTable/Filters/index.tsx b/src/Views/Components/ListTable/Filters/index.tsx index d1667f88df..925ffd0018 100644 --- a/src/Views/Components/ListTable/Filters/index.tsx +++ b/src/Views/Components/ListTable/Filters/index.tsx @@ -51,9 +51,12 @@ export const Filter = ({filter, value = null, onChange, debouncedOnChange}) => { }; // figure out what the initial filter state should be based on the filter configuration -export const getInitialFilterState = (filters) => { +export const getInitialFilterState = (filters, apiSettings) => { const state = {}; const urlParams = new URLSearchParams(window.location.search); + + // Allow third party extends filters + filters = wp.hooks.applyFilters(`give-${apiSettings.table.id}-list-table-filters`, filters); filters.map((filter) => { // if the search parameters contained a value for the filter, use that const filterQuery = decodeURI(urlParams.get(filter.name)); diff --git a/src/Views/Components/ListTable/ListTablePage/index.tsx b/src/Views/Components/ListTable/ListTablePage/index.tsx index e48a6a319a..49cdb66b7b 100644 --- a/src/Views/Components/ListTable/ListTablePage/index.tsx +++ b/src/Views/Components/ListTable/ListTablePage/index.tsx @@ -84,7 +84,7 @@ export default function ListTablePage({ }: ListTablePageProps) { const [page, setPage] = useState(1); const [perPage, setPerPage] = useState(30); - const [filters, setFilters] = useState(getInitialFilterState(filterSettings)); + const [filters, setFilters] = useState(getInitialFilterState(filterSettings, apiSettings)); const [modalContent, setModalContent] = useState<{confirm; action; label; type?: 'normal' | 'warning' | 'danger'}>({ confirm: (selected) => {}, action: (selected) => {},