From f39e99bd3c758848788ba8786a609ed708596a4c Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Wed, 4 Mar 2015 00:10:00 +0100 Subject: [PATCH] Fixed: Column sort direction will not toggle unless the same column is clicked again. --- src/UI/Shared/Grid/HeaderCell.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/UI/Shared/Grid/HeaderCell.js b/src/UI/Shared/Grid/HeaderCell.js index 8370e55e9..cf0a33113 100644 --- a/src/UI/Shared/Grid/HeaderCell.js +++ b/src/UI/Shared/Grid/HeaderCell.js @@ -97,11 +97,16 @@ module.exports = function() { var column = this.column; var sortable = Backgrid.callByNeed(column.sortable(), column, collection); if (sortable) { + var isSorted = this.$el.children('.icon-sonarr-sort-asc,.icon-sonarr-sort-desc').length !== 0; var direction = collection.state.order; - if (direction === 'ascending' || direction === -1) { - direction = 'descending'; + if (column.get('sortType') === 'fixed' || !isSorted) { + direction = column.get('direction') || 'ascending'; } else { - direction = 'ascending'; + if (direction === 'ascending' || direction === -1) { + direction = 'descending'; + } else { + direction = 'ascending'; + } } if (collection.setSorting) {