Fix sorting order in Chromium

This closes #48.
This commit is contained in:
Lucas Verney 2017-05-11 14:06:38 +02:00
parent 6272819109
commit 2bdfa8158b

View File

@ -140,15 +140,17 @@ export default {
computed: { computed: {
sortedFlats () { sortedFlats () {
return this.flats.sort( const sortedFlats = this.flats.slice(0)
sortedFlats.sort(
(flat1, flat2) => { (flat1, flat2) => {
if (this.sortOrder === 'up') { if (this.sortOrder === 'up') {
return flat1[this.sortBy] > flat2[this.sortBy] return flat1[this.sortBy] - flat2[this.sortBy]
} else { } else {
return flat1[this.sortBy] < flat2[this.sortBy] return flat2[this.sortBy] - flat1[this.sortBy]
} }
} }
) )
return sortedFlats
} }
}, },
@ -168,7 +170,7 @@ export default {
} }
}, },
showMore (event, flatId) { showMore (event, flatId) {
if (event.target.tagName === "TD") { if (event.target.tagName === 'TD') {
this.$router.push({ name: 'details', params: { id: flatId }}) this.$router.push({ name: 'details', params: { id: flatId }})
} }
}, },