Add ambassor URL sort
This commit is contained in:
parent
2300fa99ff
commit
a7b2d8fe5c
2 changed files with 12 additions and 17 deletions
|
@ -96,22 +96,12 @@ class EnhancedTable extends Component {
|
|||
? this.state.data.sort((a, b) => {
|
||||
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;
|
||||
return ((b[orderBy].hasOwnProperty('searchText') ? b[orderBy].searchText.toLowerCase() : b[orderBy].toLowerCase()) <
|
||||
(a[orderBy].hasOwnProperty('searchText') ? a[orderBy].searchText.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);
|
||||
return ((a[orderBy].hasOwnProperty('searchText') ? a[orderBy].searchText.toLowerCase() : a[orderBy].toLowerCase()) <
|
||||
(b[orderBy].hasOwnProperty('searchText') ? b[orderBy].searchText.toLowerCase() : b[orderBy].toLowerCase()) ? -1 : 1);
|
||||
});
|
||||
|
||||
this.setState({ data, order, orderBy });
|
||||
|
|
|
@ -150,8 +150,13 @@ class AmbassadorsPage extends Component {
|
|||
)
|
||||
};
|
||||
ambassador.map = app.addMapButton(ambassador, ambassador.cities);
|
||||
ambassador.link = <a target="_blank" rel="noopener noreferrer"
|
||||
href={ambassador.url}>{stripProtocol(ambassador.url)}</a>;
|
||||
ambassador.link = {
|
||||
searchText: stripProtocol(ambassador.url),
|
||||
value: (
|
||||
<a target="_blank" rel="noopener noreferrer"
|
||||
href={ambassador.url}>{stripProtocol(ambassador.url)}</a>
|
||||
)
|
||||
};
|
||||
});
|
||||
|
||||
// Once both return, update the state
|
||||
|
|
Loading…
Reference in a new issue