From d8a424d41342d0f336e2cdbf3cb324f0050f65ac Mon Sep 17 00:00:00 2001 From: Yannick ROGER Date: Wed, 25 Jan 2017 13:46:13 +0100 Subject: [PATCH] EZP-26897: Display broken when subitems sorted by not displayed column --- .../public/js/views/subitem/ez-subitemlistmoreview.js | 10 ++++++---- .../subitem/assets/ez-subitemlistmoreview-tests.js | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Resources/public/js/views/subitem/ez-subitemlistmoreview.js b/Resources/public/js/views/subitem/ez-subitemlistmoreview.js index 7d322649e..9cf89450b 100644 --- a/Resources/public/js/views/subitem/ez-subitemlistmoreview.js +++ b/Resources/public/js/views/subitem/ez-subitemlistmoreview.js @@ -123,10 +123,12 @@ YUI.add('ez-subitemlistmoreview', function (Y) { this._resetSortOrderClass(); - if (sortCondition.sortOrder === 'ASC') { - column.addClass(COLUMN_SORT_ASC_CLASS); - } else { - column.addClass(COLUMN_SORT_DESC_CLASS); + if (column) { + if (sortCondition.sortOrder === 'ASC') { + column.addClass(COLUMN_SORT_ASC_CLASS); + } else { + column.addClass(COLUMN_SORT_DESC_CLASS); + } } }, diff --git a/Tests/js/views/subitem/assets/ez-subitemlistmoreview-tests.js b/Tests/js/views/subitem/assets/ez-subitemlistmoreview-tests.js index fc89e2041..853f9e9f0 100644 --- a/Tests/js/views/subitem/assets/ez-subitemlistmoreview-tests.js +++ b/Tests/js/views/subitem/assets/ez-subitemlistmoreview-tests.js @@ -376,6 +376,12 @@ YUI.add('ez-subitemlistmoreview-tests', function (Y) { tearDown: function () { this.view.destroy(); }, + + "Should reset the view state when Location sortField is changed for a non sortable field": function () { + this._resetView(Y.bind(function () { + this.location.set('sortField', 'PATH'); + },this)); + }, })); updatePriorityTest = new Y.Test.Case({