From 2bdfa8158bb6b7dc2ac9ad9788f42bdb862b7668 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Thu, 11 May 2017 14:06:38 +0200 Subject: [PATCH] Fix sorting order in Chromium This closes #48. --- flatisfy/web/js_src/components/flatstable.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/flatisfy/web/js_src/components/flatstable.vue b/flatisfy/web/js_src/components/flatstable.vue index 0fb901b..6fb3e2d 100644 --- a/flatisfy/web/js_src/components/flatstable.vue +++ b/flatisfy/web/js_src/components/flatstable.vue @@ -140,15 +140,17 @@ export default { computed: { sortedFlats () { - return this.flats.sort( + const sortedFlats = this.flats.slice(0) + sortedFlats.sort( (flat1, flat2) => { if (this.sortOrder === 'up') { - return flat1[this.sortBy] > flat2[this.sortBy] + return flat1[this.sortBy] - flat2[this.sortBy] } 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) { - if (event.target.tagName === "TD") { + if (event.target.tagName === 'TD') { this.$router.push({ name: 'details', params: { id: flatId }}) } },