Skip to content

How to get the filtered json object after filtering by react-bootstrap-table2-filter #1324

Closed
@jackiehamchen

Description

@jackiehamchen

Question
I am getting the JSON data from Springboot backend and display in react-bootstrap-table2.

When I filter JSON data using react-bootstrap-table2-filter e.g. filter: textFilter(), I would like to send the filtered JSON data to the backend to update another react component.

However, currently I cannot find a way to get filtered JSON data, but I only have the JSON data returned from the backend.

My question is that how to get the filtered JSON object so that I can send it to the backend.

Screenshots
image

As per the story book above, I filtered the JSON data by selectFilter()/ textFilter(), how to get the currently filtered JSON data which has only two rows (from the original 10 rows from the backend).

codesandbox
Please refer to the similar code in the story book as below. Currently the data={ products } has the original JSON data (not the filtered JSON). How can I get the filtered JSON which has only two rows?

`const selectOptions = {
0: 'good',
1: 'Bad',
2: 'unknown'
};

const columns = [{
dataField: 'id',
text: 'Product ID'
}, {
dataField: 'name',
text: 'Product Name'
}, {
dataField: 'quality',
text: 'Product Quailty',
formatter: cell => selectOptions[cell],
filter: selectFilter({
options: selectOptions,
defaultValue: 2
})
}];

<BootstrapTable keyField='id' data={ products } columns={ columns } filter={ filterFactory() } />`

Thank you very much for your help.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions