Skip to content

Commit 6516860

Browse files
committed
Bug fix for group sorting
1 parent a0f7372 commit 6516860

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/controls/listView/ListView.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ export class ListView extends React.Component<IListViewProps, IListViewState> {
8888

8989
// Loop over all the groups
9090
for (const groupItems in groupedItems) {
91-
// Add the items to the updated items order array
92-
groupedItems[groupItems].forEach((item) => {
93-
updatedItemsOrder.push(item);
94-
});
9591
// Retrieve the total number of items per group
9692
const totalItems = groupedItems[groupItems].length;
9793
// Create the new group
@@ -104,7 +100,16 @@ export class ListView extends React.Component<IListViewProps, IListViewState> {
104100
// Check if child grouping available
105101
if (groupByFields[level + 1]) {
106102
// Get the child groups
107-
group.children = this._getGroups(groupedItems[groupItems], groupByFields, (level + 1), startIndex).groups;
103+
const subGroup = this._getGroups(groupedItems[groupItems], groupByFields, (level + 1), startIndex);
104+
subGroup.items.forEach((item) => {
105+
updatedItemsOrder.push(item);
106+
});
107+
group.children = subGroup.groups;
108+
} else {
109+
// Add the items to the updated items order array
110+
groupedItems[groupItems].forEach((item) => {
111+
updatedItemsOrder.push(item);
112+
});
108113
}
109114
// Increase the start index for the next group
110115
startIndex = startIndex + totalItems;

0 commit comments

Comments
 (0)