refine icon indicating copy to clipboard operation
refine copied to clipboard

[FEAT]: prepopulate initialValues in searchFormProps when syncWithLocation is true

Open mayank-meragi opened this issue 3 years ago • 13 comments

Is your feature request related to a problem? Please describe. I am setting syncWithLocation to true for useTable from Antd, the initialValues in searchFormProps is empty

Describe the solution you'd like Automatically populate initialValues in searchFormProps when syncWithLocation is true

mayank-meragi avatar Oct 04 '22 07:10 mayank-meragi

Where this method is located in this repo @mayank-meragi ?

vinayjain18 avatar Oct 04 '22 12:10 vinayjain18

@vinayjain18 https://github.com/pankod/refine/blob/next/packages/antd/src/hooks/table/useTable/useTable.ts

mayank-meragi avatar Oct 04 '22 12:10 mayank-meragi

@omeraplak can I work on this one?

toukirkhan avatar Oct 13 '22 07:10 toukirkhan

@omeraplak can I work on this one?

Yes! Happy hacking 💥

omeraplak avatar Oct 13 '22 07:10 omeraplak

@omeraplak can you provide more details to me or explain more about the issue?

toukirkhan avatar Oct 13 '22 19:10 toukirkhan

Hey @toukirkhan , The useTable hook allows filtering with an external form. You can view an example here. https://example.admin.refine.dev/orders?pageSize=10&current=1

When syncWithLocation is enabled in useTable, all filters start to sync with the URL, so when you share this link with someone else, the filters are applied to that client as well.

For example, when you enter this URL, pay attention to the filter form. You will see the filters in the URL come as initialValue. https://example.admin.refine.dev/orders?pageSize=10&current=1&filters[0][field]=q&filters[0][operator]=eq&filters[0][ value]=test&filters[1][field]=store.id&filters[1][operator]=eq&filters[1][value]=1&filters[2][field]=status.text&filters[2][operator]=in&filters[2 ][value][0]=Pending

The way to achieve this is to write the following lines, https://github.com/pankod/refine/blob/next/examples/fineFoods/admin/antd/src/pages/orders/list.tsx#L291

What is desired with this feature is that this process takes place automatically without the need to write these lines. Is everything clear to you?

omeraplak avatar Oct 14 '22 07:10 omeraplak

@omeraplak yeah I got it!!

toukirkhan avatar Oct 14 '22 07:10 toukirkhan

@omeraplak am unassigning myself as I am not able to create the output required over here. Thank you!

toukirkhan avatar Oct 14 '22 19:10 toukirkhan

I want to work on it. Please assign it to me

Mohammad-Palla avatar Oct 15 '22 09:10 Mohammad-Palla

I want to work on it. Please assign it to me

Done! Happy hacking! 🚀

omeraplak avatar Oct 17 '22 06:10 omeraplak

Hey @Mohammad-Palla , Any updates on this issue?

omeraplak avatar Oct 20 '22 05:10 omeraplak

Unassigned this issue from @Mohammad-Palla due to inactivity. If anyone interested in this issue, please leave a comment 🚀

aliemir avatar Oct 24 '22 06:10 aliemir

@omeraplak @aliemir

Please help to review PR https://github.com/refinedev/refine/pull/2988 for this issue.

leapful avatar Nov 11 '22 03:11 leapful

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 21 '23 08:02 stale[bot]