Download csv files on filtered table

I have a table and I have a split button that filters the table based on a participation column I made. I want to be able to export the data as a csv/excel file that maintains the filter that is set. I noticed that when I apply a filter then export, the export is not dynamic and is not accounting for the filter I set, so all the data is being exported. I am currently using an export button with a dropdown to select csv or excel and using a utils.exportData() event handler upon click.

participation statuses: opt in or opt out

filter on split button:
All (shows all records that are both opted in/out)
opt in (shows only records that are opted in)
opt out (only records that are opted out)

desired output:
apply opt in as filter on split button, only opt in records get exported to csv/excel
similar results for the other filters.

Hello @jewis749, currently new table component doesnt have any option to get filtered data. You can use legacy table temporarily.

I am a little new to retool, so I do not really know how to implement a legacy table.

You can get filtered data by using {{ tableLegacy1.displayedData }}

I figured out a way to get my desired output by making an event handler on the button that controls the table and exports the data. So previous I was doing utils.export but table.exportData was able to export the data with the filter.

1 Like

Just wanted to chime in that we now have a method that you can use to get the filtered/displayed data of a table (getDisplayedData()):

3 Likes