diff --git a/src/components/EnhancedTable.js b/src/components/EnhancedTable.js index c2eb106..f42fb57 100644 --- a/src/components/EnhancedTable.js +++ b/src/components/EnhancedTable.js @@ -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 }); diff --git a/src/components/pages/AmbassadorsPage.js b/src/components/pages/AmbassadorsPage.js index 07b8b16..b25c16a 100644 --- a/src/components/pages/AmbassadorsPage.js +++ b/src/components/pages/AmbassadorsPage.js @@ -150,8 +150,13 @@ class AmbassadorsPage extends Component { ) }; ambassador.map = app.addMapButton(ambassador, ambassador.cities); - ambassador.link = {stripProtocol(ambassador.url)}; + ambassador.link = { + searchText: stripProtocol(ambassador.url), + value: ( + {stripProtocol(ambassador.url)} + ) + }; }); // Once both return, update the state @@ -267,7 +272,7 @@ class AmbassadorsPage extends Component { const infoDescription =