Skip to content

Commit

Permalink
[docs] Improve the Table sorting logic (#12348)
Browse files Browse the repository at this point in the history
* Update EnhancedTable.js

* simpler logic
  • Loading branch information
xkenmon authored and oliviertassinari committed Jul 31, 2018
1 parent e15e3a2 commit fde400f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions docs/src/pages/demos/tables/EnhancedTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ function createData(name, calories, fat, carbs, protein) {
}

function getSorting(order, orderBy) {
return order === 'desc'
? (a, b) => (b[orderBy] < a[orderBy] ? -1 : 1)
: (a, b) => (a[orderBy] < b[orderBy] ? -1 : 1);
return order === 'desc' ? (a, b) => b[orderBy] - a[orderBy] : (a, b) => a[orderBy] - b[orderBy];
}

const columnData = [
Expand Down

0 comments on commit fde400f

Please sign in to comment.