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.
7 Replies
robust-apricotOP•3y ago
So i have set the initial values using variables like this, but the checkbox value isnt being added to the query
robust-apricotOP•3y ago
robust-apricotOP•3y 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
robust-apricotOP•3y 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
I created an example for you 🥁
https://stackblitz.com/edit/pankod-refine-5qrq9l?file=src%2Fpages%2Fposts%2Flist.tsx%3AL180&preset=node
robust-apricotOP•3y ago
Legend! i really like it. Im going to steal .. i mean borrow this