Kirill Novikov
Kirill Novikov

Reputation: 3067

How to access antd table current data state?

I have a table based on antd table component with custom filters like components-table-demo-filter-search

By default, I can only access to dataSource property which I provide but I can't find a way to get access to dataSource after filtering. How can I get access to filtered data?

Upvotes: 0

Views: 1120

Answers (1)

Lin Du
Lin Du

Reputation: 102247

You can get the filtered data source via the extra parameter of the onChange callback of the Table component.

The signature of onChange:

function(pagination, filters, sorter, extra: { currentDataSource: [], action: paginate | sort | filter })

When the custom filterSearch function executes, the onChange callback will be executed, and you will get the filtered data source by accessing extra.currentDataSource.

Upvotes: 2

Related Questions