Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/tree view selection maximum item count #808

Merged
merged 3 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion projects/fhi-angular-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# 5.3.0
# Unreleased

> Feb 6, 2025

* :bug: **Bugfix** Make sure item ids always unique independent of the item count at any level in the tree [(#808)](https://github.com/folkehelseinstituttet/Fhi.Frontend.Demo/pull/808)

## 5.3.0

> Jan 22, 2025

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,17 @@ export class FhiTreeViewSelectionComponent implements OnInit, OnChanges {
return itemsState;
}

private createIds(items: Item[], id?: number) {
private createIds(items: Item[], id?: number): number {
id = id ? id : 0;

items.forEach((item) => {
item.internal = {
id: this.instanceID + '-' + ++id,
};
if (item.children && item.children.length > 0) {
this.createIds(item.children, id * 10);
proand marked this conversation as resolved.
Show resolved Hide resolved
id = this.createIds(item.children, id);
}
});
return id;
}
}
Loading