You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Virtual column can also be used as a shorthand for a complex filtering.
86
+
Lets say we want to divide apartments into two types: "base" ones and "luxury" and then allow admins to filter apartments by this category. Condition for being a "luxury" apartment is either having more then 80 sq.m area or costing more then 100k.
87
+
One way to do it is to actually add a real column to a table and then fill it every time new apartment is added. A more simple way is to add a virtual column and then use `list.beforeDatasourceRequest` hook to replace filtering on this column with desired one.
88
+
For this purpose following changes will be required for apartments config:
89
+
90
+
```ts title='./resources/apartments.ts'
91
+
...
92
+
resourceId:'aparts',
93
+
...
94
+
hooks: {
95
+
...
96
+
list: {
97
+
beforeDatasourceRequest:async ({ query }: { query: any }) => {
0 commit comments