Skip to content

Commit 6691834

Browse files
committed
docs: update universal search to deprecated status and add quick filters documentation
https://web.tracklify.com/project/2b7ZVgE5/AdminForth/1262/OtPz3u3w/rework-i-line-filters-plugin
1 parent 0b1d03f commit 6691834

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

adminforth/documentation/docs/tutorial/08-Plugins/18-universal-filters.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Universal Search
1+
# Universal Search (legacy)
2+
> **Deprecated:** Prefer the [**Quick Filters**](/docs/tutorial/Plugins/quick-filters) plugin. It provides the same functionality and more.
23
34
Ephemeral, debounced multi‑column search for List pages. A lightweight input (injected at `beforeActionButtons`) sends the term with each list request; a hook expands it server‑side into a single `OR` filter group over your configured columns. The term never enters the standard filter store, so:
45

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Quick filters
2+
Allows you to add search input or select with preseted filters at the list view
3+
4+
## Setup
5+
6+
First, install the plugin:
7+
```bash
8+
pnpm i @adminforth/quick-filters
9+
```
10+
Then add it to yours resource:
11+
12+
```ts title="./resources/apartments.ts"
13+
import QuickFiltersPlugin from '@adminforth/quick-filters';
14+
```
15+
16+
And finally add it to list of plugins:
17+
18+
```ts title="./resources/apartments.ts"
19+
plugins: [
20+
...
21+
//diff-add
22+
new QuickFiltersPlugin({
23+
//diff-add
24+
filters: [
25+
//diff-add
26+
{
27+
//diff-add
28+
name: 'Listed',
29+
//diff-add
30+
enum: [
31+
//diff-add
32+
{ label: 'Listed', filters: () => Filters.EQ('listed', true) },
33+
//diff-add
34+
{ label: 'Not listed', filters: () => Filters.EQ('listed', false) },
35+
//diff-add
36+
]
37+
//diff-add
38+
},
39+
//diff-add
40+
{
41+
//diff-add
42+
name: 'Title',
43+
//diff-add
44+
searchInput: (searchVal) => Filters.ILIKE('title', searchVal)
45+
//diff-add
46+
},
47+
//diff-add
48+
]
49+
//diff-add
50+
}),
51+
...
52+
]
53+
```
54+
55+
![alt text](quick-filters.png)
56+
57+
64.2 KB
Loading

0 commit comments

Comments
 (0)