Default Values of Filter panel of form being lost even though UI reflects a value
Hey guys wondering if you can help me
We have a Page with a table and a filter form.
We are setting some default / initial filters for the form which works fine
in the attached image you can see all the filter values are not being attached to the query.
even though in the UI the form shows it has value as per the second image
UPDATE: Ok so using initial values is working in the filter form.
![No description](https://cdn.answeroverflow.com/1025227088011198574/unknown.png)
![No description](https://cdn.answeroverflow.com/1025227088623575050/unknown.png)
7 Replies
exotic-emerald•2y ago
So i have set the initial values using variables like this, but the checkbox value isnt being added to the query
![No description](https://cdn.answeroverflow.com/1025236862291415120/unknown.png)
![No description](https://cdn.answeroverflow.com/1025236862794727545/unknown.png)
exotic-emerald•2y ago
![No description](https://cdn.answeroverflow.com/1025240242665558016/unknown.png)
exotic-emerald•2y ago
Am i doing the wrong thing trying to control the first load data through the filter panel?
Hey @ben_g. 👋,
Try this, add initialFilter to your useTable and set your form's defaultValues from useTable filters ⚡️
Example:
https://github.com/pankod/refine/blob/next/examples/fineFoods/admin/antd/src/pages/orders/list.tsx#L292
GitHub
refine/list.tsx at next · pankod/refine
Build your React-based CRUD applications, without constraints. - refine/list.tsx at next · pankod/refine
exotic-emerald•2y ago
Hey Thanks @Omer, that's awesome, i ended up doing something like this
adding the initialFilterValues in the main table section and then drilling them into the filter panel inputs
![No description](https://cdn.answeroverflow.com/1025295246055182346/unknown.png)
![No description](https://cdn.answeroverflow.com/1025295246516551760/unknown.png)
I created an example for you 🥁
https://stackblitz.com/edit/pankod-refine-5qrq9l?file=src%2Fpages%2Fposts%2Flist.tsx%3AL180&preset=node
exotic-emerald•2y ago
Legend! i really like it. Im going to steal .. i mean borrow this