When i try to search en object using 2 input strings or more i got not found. this is occur due to that the search field does not ignore the "space" char and therefor i get an empty result.
i attached my code:
import React, {Component} from 'react'
import { withRouter,Redirect} from 'react-router-dom'
import { Button } from 'reactstrap';
import { MDBDataTable, MDBBtn, MDBIcon } from 'mdbreact';
class Applicants extends Component {
constructor() {
super()
this.state = {
data : {
columns: [
{
label: 'Name',
field: 'name',
sort: 'asc',
width: 150
},
{
label: 'Position',
field: 'position',
sort: 'asc',
width: 270
},
{
label: 'Stage',
field: '',
sort: 'asc',
width: 200
},
{
label: 'Start date',
field: 'date',
sort: 'asc',
width: 150
},
{
label: 'Actions',
field: 'actions',
sort: 'asc',
width: 50
}
],
rows: [
{
name: 'Tiger Nixon',
position: 'System Architect',
office: 'Edinburgh',
date: '2011/04/25',
actions: <MDBBtn size="sm" color="indigo" ><MDBIcon icon="pencil" size="lg"/></MDBBtn>
},
{
name: 'Garrett Winters',
position: 'Accountant',
office: 'Tokyo',
date: '2011/07/25',
actions: <MDBBtn size="sm" color="indigo" ><MDBIcon icon="pencil" size="lg"/></MDBBtn>
},
{
name: 'Ashton Cox',
position: 'Junior Technical Author',
office: 'San Francisco',
date: '2009/01/12',
actions: <MDBBtn size="sm" color="indigo" ><MDBIcon icon="pencil" size="lg"/></MDBBtn>
},
{
name: 'Cedric Kelly',
position: 'Senior Javascript Developer',
office: 'Edinburgh',
date: '2012/03/29',
actions: <MDBBtn size="sm" color="indigo" ><MDBIcon icon="pencil" size="lg"/></MDBBtn>
},
{
name: 'Airi Satou',
position: 'Accountant',
office: 'Tokyo',
date: '2008/11/28',
actions: <MDBBtn size="sm" color="indigo" ><MDBIcon icon="pencil" size="lg"/></MDBBtn>
}
]
}
}
}
getEditButton(params) {
return <Button className="fa fa-pencil" color="link"></Button>
}
render() {
if (!localStorage.usertoken){
return (<Redirect to="/login"></Redirect>)
} else {
return (
<div className="container" style={{maxWidth: 1440, marginTop:20}}>
<MDBDataTable
striped
bordered
large="true"
data={this.state.data}
/>
</div>
)
}
}
}
export default withRouter(Applicants)