question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jackiehamchencommented, Apr 12, 2020

BTW, @jackiehamchen when do you want to get the the filtered data? if should be performed automatically when filter trigger? or just press a button by user?

@AllenFang currently the use case is to get the filtered json as shown in the table automatically when filter is triggered. Thus, another react component can get updated automatically too e.g. <ChildComponent filterData={this.state.data}/>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get filtred data, react-bootstrap-table2 - Stack Overflow
One way you could do that is by providing a different implementation of the filter prop, and get the data that you need...
Read more >
react-bootstrap-table2-filter examples - CodeSandbox
Learn how to use react-bootstrap-table2-filter by viewing and forking ... data table using React and Redux that fetches JSON from a predefined API....
Read more >
react-bootstrap-table2-filter - npm package - Snyk
Learn more about react-bootstrap-table2-filter: package health score, ... date filter accept a Javascript Date object in your raw data and you have to...
Read more >
Column Filter Props · react-bootstrap-table2
Add filter property on column object: textFilter; selectFilter; multiSelectFilter; numberFilter; dateFilter; customFilter. For example: import BootstrapTable ...
Read more >
Using JSON Filtering - YouTube
JSON Filtering is a new feature at Prisma 2.23 which allows you to filter through data stored in JSON columns. In this video,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found