Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select filter - wrong filtering #517

Closed
Najdan opened this issue Jun 20, 2016 · 2 comments
Closed

Select filter - wrong filtering #517

Najdan opened this issue Jun 20, 2016 · 2 comments

Comments

@Najdan
Copy link

Najdan commented Jun 20, 2016

There's a weird issue with select filter when I select one value and getting wrong filter results in table.

I think that problem is related to "key" from qualityType (it's showing data in table for 1, and 17 which contains 1 inside). For unknown "key" is 2 and it's not shown as result of filtering.
const qualityType = { 1: 'bad', 2: 'unknown', 17: 'good' };

Check this gist - Select filter.js
Check next images:
1. Bad selected with key 1 - this is wrong
2016-06-20 16_15_49-react-bootstrap-table demo
2. Unknown selected with key 2
2016-06-20 16_16_16-react-bootstrap-table demo
3. Good selected with key 17
2016-06-20 16_16_35-react-bootstrap-table demo

Code is just a small modification from example - select-filter-with-default-value.js
Only changes made are qualityType and product.push method.

Am I doing something wrong?
Feel free to contact me if you need any other information.

Regards,
Najdan

@AllenFang
Copy link
Owner

@Najdan, actually it's not a bug, it's just a bad examples...because the value of field qualityType is number(ex: 1,2,3), but the select filter in react-bootstrap-table is use string.indexOf() to filter data, so that's why you got this result.

BTW, there's a enhancement need to do, react-bootstrap-table support filterFormatted props on <TableHeaderColumn> but it only format the data before filtering but I forgot to format the formatExtraData.

Anyway, I'll do a patch for this issues and make examples more better. Thanks you

@AllenFang
Copy link
Owner

@Najdan, Fixed on v2.3.7. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants