Topic: Search functionality in Search table is not ignoring "space" char

Matan Tubul free asked 5 years ago


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)

Matan Tubul free answered 5 years ago


Thanks for the  response


Jakub Mandra staff commented 5 years ago

We are always open for suggestions, so if you have any needs, don't hesitate to report :)


Jakub Mandra staff answered 5 years ago


It is not ignoring white spaces, but it is searching matching strings.
So typing "ti nix" wont respond with proper result.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.8.4
  • Device: Laptop
  • Browser: FireFox
  • OS: Ubuntu 18.04
  • Provided sample code: No
  • Provided link: No