Skip to content

Commit 77e216a

Browse files
committed
chore: update setFilter docs
1 parent 3709472 commit 77e216a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

adminforth/spa/src/adminforth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class FrontendAPI implements FrontendAPIInterface {
125125
if(this.filtersStore.filters.some((f: any) => {return f.field === filter.field && f.operator === filter.operator})){
126126
throw new Error(`Filter ${filter.field} with operator ${filter.operator} already exists`)
127127
} else {
128-
this.filtersStore.setFilter(filter)
128+
this.filtersStore.setFilter(filter)
129129
}
130130
}
131131
}

adminforth/types/FrontendAPI.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@ export interface FrontendAPIInterface {
8282
*/
8383
closeThreeDotsDropdown(): void;
8484

85-
8685
/**
87-
* Set a filter in the list
88-
* Works only when user located on the list page.
86+
* Set a filter in the list.
87+
* Works only when user located on the list page. If filter already exists, it will be replaced with the new one.
8988
* Can be used to set filter from charts or other components in pageInjections.
9089
*
9190
* Example:
@@ -96,11 +95,15 @@ export interface FrontendAPIInterface {
9695
* adminforth.list.setFilter({field: 'name', operator: 'ilike', value: 'john'})
9796
* ```
9897
*
98+
* Please note that you can set/update filter even for fields which have showIn.filter=false in resource configuration.
99+
* Also you can set filter for virtual columns. For example Universal search plugin calls updateFilter for virtual column which has showIn.filter=false (because we dont want to show this column in filter dropdown, plugin renders its own filter UI)
100+
*
99101
* @param filter - The filter to set
100102
*/
101103
setFilter(filter: FilterParams): void;
102104

103105
/**
106+
* DEPRECATED: does the same as setFilter, kept for backward compatibility
104107
* Update a filter in the list
105108
*
106109
* Example:

0 commit comments

Comments
 (0)