Let user put spaces in filterbar. Closes #14

This commit is contained in:
Lucas Verney 2016-08-08 12:35:21 +02:00
parent 177c67845d
commit 247c71c9a7
5 changed files with 9 additions and 9 deletions

View File

@ -59,14 +59,14 @@ class SongsTableCSS extends Component {
if (this.props.filterText) { if (this.props.filterText) {
// Use Fuse for the filter // Use Fuse for the filter
displayedSongs = new Fuse( displayedSongs = new Fuse(
this.props.songs.toArray(), this.props.songs.toJS(),
{ {
"keys": ["name"], "keys": ["name"],
"threshold": 0.4, "threshold": 0.4,
"include": ["score"] "include": ["score"]
}).search(this.props.filterText); }).search(this.props.filterText);
// Keep only items in results // Keep only items in results
displayedSongs = displayedSongs.map(function (item) { return item.item; }); displayedSongs = displayedSongs.map(function (item) { return new Immutable.Map(item.item); });
} }
let rows = []; let rows = [];
@ -136,7 +136,7 @@ export default class FilterablePaginatedSongsTable extends Component {
handleUserInput (filterText) { handleUserInput (filterText) {
this.setState({ this.setState({
filterText: filterText.trim() filterText: filterText
}); });
} }

View File

@ -98,7 +98,7 @@ export class Grid extends Component {
} }
// Use Fuse for the filter // Use Fuse for the filter
let result = new Fuse( let result = new Fuse(
props.items.toArray(), props.items.toJS(),
{ {
"keys": ["name"], "keys": ["name"],
"threshold": 0.4, "threshold": 0.4,
@ -241,7 +241,7 @@ export default class FilterablePaginatedGrid extends Component {
handleUserInput (filterText) { handleUserInput (filterText) {
this.setState({ this.setState({
filterText: filterText.trim() filterText: filterText
}); });
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long