Fix ambassador's telegram sort
This commit is contained in:
parent
f525d6ef40
commit
2300fa99ff
1 changed files with 20 additions and 2 deletions
|
@ -93,8 +93,26 @@ class EnhancedTable extends Component {
|
||||||
|
|
||||||
const data =
|
const data =
|
||||||
order === 'desc'
|
order === 'desc'
|
||||||
? this.state.data.sort((a, b) => (b[orderBy].toLowerCase() < a[orderBy].toLowerCase() ? -1 : 1))
|
? this.state.data.sort((a, b) => {
|
||||||
: this.state.data.sort((a, b) => (a[orderBy].toLowerCase() < b[orderBy].toLowerCase() ? -1 : 1));
|
console.log(a[orderBy]);
|
||||||
|
console.log(b[orderBy]);
|
||||||
|
if(a[orderBy].hasOwnProperty('searchText')){
|
||||||
|
a[orderBy] = a[orderBy].searchText;
|
||||||
|
}
|
||||||
|
if(b[orderBy].hasOwnProperty('searchText')){
|
||||||
|
b[orderBy] = b[orderBy].searchText;
|
||||||
|
}
|
||||||
|
return b[orderBy].toLowerCase() < a[orderBy].toLowerCase() ? -1 : 1;
|
||||||
|
})
|
||||||
|
: this.state.data.sort((a, b) => {
|
||||||
|
if(a[orderBy].hasOwnProperty('searchText')){
|
||||||
|
a[orderBy] = a[orderBy].searchText;
|
||||||
|
}
|
||||||
|
if(b[orderBy].hasOwnProperty('searchText')){
|
||||||
|
b[orderBy] = b[orderBy].searchText;
|
||||||
|
}
|
||||||
|
return (a[orderBy].toLowerCase() < b[orderBy].toLowerCase() ? -1 : 1);
|
||||||
|
});
|
||||||
|
|
||||||
this.setState({ data, order, orderBy });
|
this.setState({ data, order, orderBy });
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue