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({