Skip to content

Commit 9767260

Browse files
author
Jens Vannerum
committed
111768: add back necessary setCurrentValue calls that were removed earlier
1 parent 5c84ede commit 9767260

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import { UntypedFormGroup } from '@angular/forms';
1212

1313
import { Observable, of as observableOf } from 'rxjs';
14-
import { catchError, map, tap } from 'rxjs/operators';
14+
import { catchError, distinctUntilChanged, map, tap } from 'rxjs/operators';
1515
import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap';
1616
import { DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core';
1717

@@ -79,6 +79,10 @@ export class DsDynamicScrollableDropdownComponent extends DsDynamicVocabularyCom
7979
tap(() => this.loading = false)
8080
).subscribe((list: PaginatedList<VocabularyEntry>) => {
8181
this.optionsList = list.page;
82+
if (this.model.value) {
83+
this.setCurrentValue(this.model.value, true);
84+
}
85+
8286
this.updatePageInfo(
8387
list.pageInfo.elementsPerPage,
8488
list.pageInfo.currentPage,
@@ -88,6 +92,11 @@ export class DsDynamicScrollableDropdownComponent extends DsDynamicVocabularyCom
8892
this.selectedIndex = 0;
8993
this.cdr.detectChanges();
9094
});
95+
96+
this.group.get(this.model.id).valueChanges.pipe(distinctUntilChanged())
97+
.subscribe((value) => {
98+
this.setCurrentValue(value);
99+
});
91100
}
92101

93102
/**

0 commit comments

Comments
 (0)