From 5491671a2e0ae58d2d12156b0ac4e673a4b457c8 Mon Sep 17 00:00:00 2001 From: Bernt Andersen Date: Wed, 9 Oct 2024 09:56:53 +0200 Subject: [PATCH] Make sure there is no duplicate IDs on checkboxes (or radios) if more than one instance on the same page --- projects/fhi-angular-components/CHANGELOG.md | 8 +++++++- .../fhi-tree-view-selection.component.ts | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/fhi-angular-components/CHANGELOG.md b/projects/fhi-angular-components/CHANGELOG.md index 99591c14..2c2197fe 100644 --- a/projects/fhi-angular-components/CHANGELOG.md +++ b/projects/fhi-angular-components/CHANGELOG.md @@ -1,4 +1,10 @@ -# 5.0.1 +# Unreleased + +> Oct 9, 2024 + +* :bug: **Bugfix** Make sure there is no duplicate IDs on checkboxes (or radios) if more than one instance of `FhiTreeViewCheckboxComponent` or `FhiTreeViewRadioComponent` on the same page. + +## 5.0.1 > Sep 20, 2024 diff --git a/projects/fhi-angular-components/src/lib/fhi-tree-view-selection/fhi-tree-view-selection.component.ts b/projects/fhi-angular-components/src/lib/fhi-tree-view-selection/fhi-tree-view-selection.component.ts index 74e4335a..b15bd1b2 100644 --- a/projects/fhi-angular-components/src/lib/fhi-tree-view-selection/fhi-tree-view-selection.component.ts +++ b/projects/fhi-angular-components/src/lib/fhi-tree-view-selection/fhi-tree-view-selection.component.ts @@ -217,6 +217,8 @@ export class FhiTreeViewSelectionComponent implements OnInit, OnChanges { items.forEach((item) => { if (item.id === undefined) { item.id = this.instanceID + '-' + itemID++; + } else { + item.id = this.instanceID + '-' + item.id; } if (item.children && item.children.length > 0) { this.createIds(item.children, itemID * 10);