From 6d2c735847918bd3c717f58a2f10be0fd3a01a8b Mon Sep 17 00:00:00 2001 From: ccrowhurstram Date: Fri, 28 Aug 2015 03:11:19 +0100 Subject: [PATCH] fix(groupRow): table columns are lost when switching between groups --- src/scripts/ngTableGroupRowController.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/scripts/ngTableGroupRowController.js b/src/scripts/ngTableGroupRowController.js index 41b8c74d..765374b1 100644 --- a/src/scripts/ngTableGroupRowController.js +++ b/src/scripts/ngTableGroupRowController.js @@ -66,21 +66,19 @@ } function groupBy(group){ - if (group.groupable){ - if (group.groupable($scope) === $scope.$selGroup){ - changeSortDirection(); - } else { - var existingGroupCol = findGroupColumn($scope.$selGroup); - if (existingGroupCol && existingGroupCol.show.assign && group.show.assign){ - existingGroupCol.show.assign($scope, true); + if (isSelectedGroup(group)){ + changeSortDirection(); + } else { + var existingGroupCol = findGroupColumn($scope.$selGroup); + if (existingGroupCol && existingGroupCol.show.assign){ + existingGroupCol.show.assign($scope, true); + } + if (group.groupable){ + if (group.show.assign){ group.show.assign($scope, false); } $scope.params.group(group.groupable($scope)); - } - } else{ - if (group === $scope.$selGroup){ - changeSortDirection(); - } else { + } else{ $scope.params.group(group); } }