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) => {
|
? this.state.data.sort((a, b) => {
|
||||||
console.log(a[orderBy]);
|
console.log(a[orderBy]);
|
||||||
console.log(b[orderBy]);
|
console.log(b[orderBy]);
|
||||||
if(a[orderBy].hasOwnProperty('searchText')){
|
return ((b[orderBy].hasOwnProperty('searchText') ? b[orderBy].searchText.toLowerCase() : b[orderBy].toLowerCase()) <
|
||||||
a[orderBy] = a[orderBy].searchText;
|
(a[orderBy].hasOwnProperty('searchText') ? a[orderBy].searchText.toLowerCase() : a[orderBy].toLowerCase()) ? -1 : 1);
|
||||||
}
|
|
||||||
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) => {
|
: this.state.data.sort((a, b) => {
|
||||||
if(a[orderBy].hasOwnProperty('searchText')){
|
return ((a[orderBy].hasOwnProperty('searchText') ? a[orderBy].searchText.toLowerCase() : a[orderBy].toLowerCase()) <
|
||||||
a[orderBy] = a[orderBy].searchText;
|
(b[orderBy].hasOwnProperty('searchText') ? b[orderBy].searchText.toLowerCase() : b[orderBy].toLowerCase()) ? -1 : 1);
|
||||||
}
|
|
||||||
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 });
|
||||||
|
|
|
@ -150,8 +150,13 @@ class AmbassadorsPage extends Component {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
ambassador.map = app.addMapButton(ambassador, ambassador.cities);
|
ambassador.map = app.addMapButton(ambassador, ambassador.cities);
|
||||||
ambassador.link = <a target="_blank" rel="noopener noreferrer"
|
ambassador.link = {
|
||||||
href={ambassador.url}>{stripProtocol(ambassador.url)}</a>;
|
searchText: stripProtocol(ambassador.url),
|
||||||
|
value: (
|
||||||
|
<a target="_blank" rel="noopener noreferrer"
|
||||||
|
href={ambassador.url}>{stripProtocol(ambassador.url)}</a>
|
||||||
|
)
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Once both return, update the state
|
// Once both return, update the state
|
||||||
|
|
Loading…
Reference in a new issue