Merge pull request #1745 from chandaniprajapati/react-datatable-search-issue

This commit is contained in:
Hugo Bernier 2021-03-10 23:56:48 -05:00 committed by GitHub
commit c8b1efd50d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -41,7 +41,7 @@ Version|Date|Comments
-------|----|-------- -------|----|--------
1.0|February 19, 2021|Initial release 1.0|February 19, 2021|Initial release
1.1|February 24, 2021|Added support for large lists 1.1|February 24, 2021|Added support for large lists
1.2|March 01, 2021|Fixed search issue for number field
## Disclaimer ## Disclaimer
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

View File

@ -1,6 +1,6 @@
{ {
"name": "react-datatable", "name": "react-datatable",
"version": "0.0.1", "version": "1.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -143,8 +143,8 @@ export default class ReactDatatable extends React.Component<IReactDatatableProps
let { sortingFields, listItems, searchText } = this.state; let { sortingFields, listItems, searchText } = this.state;
if (searchText) { if (searchText) {
if (searchBy) { if (searchBy) {
listItems = listItems.filter(l => searchBy.some(field => { listItems = listItems && listItems.length && listItems.filter(l => searchBy.some(field => {
return (l[field] && l[field].toLowerCase().includes(searchText.toLowerCase())); return (l[field] && l[field].toString().toLowerCase().includes(searchText.toLowerCase()));
})); }));
} }
} }