efficient-indigoE
Refine3y ago
4 replies
efficient-indigo

[antd] using filterDropdown and RangePicker to filter date in a range of dates

Hi, I'm having some trouble filtering data using <DatePicker.RangePicker> and <Filterdorpdown> from antd.

I have a requirement where i need to filter data in a range of dates, after i select a range of dates and click filter, it automatically sends out an XHR request which is great,
but i want to customize the url param and i'm struggling to find a way to do so.

currently the url looks like this: API_ENDPOINT?createdAt=${dateString}&createAt=${dateString} ;
ultimately i want something like this: API_ENDPOINT?startDate=${unixTimestamp}&endDate=${unixTimestamp}

I've tried to use the confirm props in filterDropdownProps and setFilters from useTable, but it doesn't seem to achive what i want. (or do i need to write my own dataProvider to achieve this?)
Here is a code sandbox link for demonstration purpose: https://codesandbox.io/s/tender-sammet-2z6eje?file=/src/pages/posts/list.tsx

Any suggestions would be helpful! Thanks a lot!
Was this page helpful?