Merge pull request #1745 from chandaniprajapati/react-datatable-search-issue
This commit is contained in:
commit
c8b1efd50d
|
@ -41,7 +41,7 @@ Version|Date|Comments
|
|||
-------|----|--------
|
||||
1.0|February 19, 2021|Initial release
|
||||
1.1|February 24, 2021|Added support for large lists
|
||||
|
||||
1.2|March 01, 2021|Fixed search issue for number field
|
||||
## 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.**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "react-datatable",
|
||||
"version": "0.0.1",
|
||||
"version": "1.1.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -143,8 +143,8 @@ export default class ReactDatatable extends React.Component<IReactDatatableProps
|
|||
let { sortingFields, listItems, searchText } = this.state;
|
||||
if (searchText) {
|
||||
if (searchBy) {
|
||||
listItems = listItems.filter(l => searchBy.some(field => {
|
||||
return (l[field] && l[field].toLowerCase().includes(searchText.toLowerCase()));
|
||||
listItems = listItems && listItems.length && listItems.filter(l => searchBy.some(field => {
|
||||
return (l[field] && l[field].toString().toLowerCase().includes(searchText.toLowerCase()));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue