react-datatable: fixed search issue for number field
This commit is contained in:
parent
60cd3649bf
commit
47729d791e
|
@ -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.**
|
||||
|
|
|
@ -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