Skip to content

Commit

Permalink
fixed duplicate column entry in groupOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadi Shaheen committed Apr 29, 2020
1 parent bb26845 commit 3aa5fd7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions jfoenix/src/main/java/com/jfoenix/controls/JFXTreeTableView.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,15 @@ public void group(TreeTableColumn<S, ?>... treeTableColumns) {
if (originalRoot == null) {
originalRoot = getRoot();
}
List<TreeTableColumn<S, ?>> toBeAdded = new ArrayList<>();
for (TreeTableColumn<S, ?> treeTableColumn : treeTableColumns) {
if (groupOrder.contains(treeTableColumn)) {
continue;
}
toBeAdded.add(treeTableColumn);
groups = group(treeTableColumn, groups, null, (RecursiveTreeItem<S>) originalRoot);
}
groupOrder.addAll(treeTableColumns);
groupOrder.addAll(toBeAdded);
// update table ui
buildGroupedRoot(groups, null, 0);
} catch (Exception e) {
Expand All @@ -248,7 +250,7 @@ private void refreshGroups(List<TreeTableColumn<S, ?>> groupColumns) {
for (TreeTableColumn<S, ?> treeTableColumn : groupColumns) {
groups = group(treeTableColumn, groups, null, (RecursiveTreeItem<S>) originalRoot);
}
groupOrder.addAll(groupColumns);
groupOrder.setAll(groupColumns);
// update table ui
buildGroupedRoot(groups, null, 0);
}
Expand All @@ -264,9 +266,7 @@ public void unGroup(TreeTableColumn<S, ?>... treeTableColumns) {
lock.lock();
if (groupOrder.size() > 0) {
groupOrder.removeAll(treeTableColumns);
List<TreeTableColumn<S, ?>> grouped = new ArrayList<>();
grouped.addAll(groupOrder);
groupOrder.clear();
List<TreeTableColumn<S, ?>> grouped = new ArrayList<>(groupOrder);
JFXUtilities.runInFXAndWait(() -> {
ArrayList<TreeTableColumn<S, ?>> sortOrder = new ArrayList<>();
sortOrder.addAll(getSortOrder());
Expand Down

0 comments on commit 3aa5fd7

Please sign in to comment.