diff --git a/.changeset/cuddly-groups-bake.md b/.changeset/cuddly-groups-bake.md new file mode 100644 index 0000000..49acc1c --- /dev/null +++ b/.changeset/cuddly-groups-bake.md @@ -0,0 +1,5 @@ +--- +'@warkypublic/oranguru': patch +--- + +Added searchfields diff --git a/src/Gridler/components/GridlerStore.tsx b/src/Gridler/components/GridlerStore.tsx index a4549d9..9f8d50d 100644 --- a/src/Gridler/components/GridlerStore.tsx +++ b/src/Gridler/components/GridlerStore.tsx @@ -90,6 +90,7 @@ export interface GridlerProps extends PropsWithChildren { rowHeight?: number; scrollToRowKey?: number; + searchFields?: Array; searchStr?: string; sections?: { bottom?: React.ReactNode; diff --git a/src/Gridler/components/adaptors/GlidlerAPIAdaptorForGoLangv2.tsx b/src/Gridler/components/adaptors/GlidlerAPIAdaptorForGoLangv2.tsx index f6ed717..ba66015 100644 --- a/src/Gridler/components/adaptors/GlidlerAPIAdaptorForGoLangv2.tsx +++ b/src/Gridler/components/adaptors/GlidlerAPIAdaptorForGoLangv2.tsx @@ -35,6 +35,7 @@ function _GlidlerAPIAdaptorForGoLangv2(props: GlidlerAPIAdaptorForG const pageSize = getState('pageSize'); const colFilters = getState('colFilters'); const searchStr = getState('searchStr'); + const searchFields = getState('searchFields'); const _active_requests = getState('_active_requests'); setState('loadingData', true); try { @@ -72,7 +73,12 @@ function _GlidlerAPIAdaptorForGoLangv2(props: GlidlerAPIAdaptorForG if (searchStr && searchStr !== '') { columns - ?.filter((f) => !f.disableFilter && !f.disableSearch) + ?.filter( + (f) => + !f.disableFilter && + !f.disableSearch && + ((searchFields ?? []).length == 0 || searchFields?.includes(f.id)) + ) ?.forEach((filter: any) => { ops.push({ name: `${filter.id}`,