Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
fix: can select parent on simple tree with onlySelectParent=true
Browse files Browse the repository at this point in the history
  • Loading branch information
Hervé TINANT committed Jul 13, 2017
1 parent 0001181 commit 7f76f9f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/lib/src/service/select.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,19 @@ export class SelectService {
private getSelectedItems(array: SelectableItem[]): SelectableItem[] {
if (this.Configuration.isValid()) {
let res: SelectableItem[] = [];
array.forEach(v => {
for (let v of array) {
if (v.hasChild && v.selected === true) {
if (this._options.allowMultiple) {
if (v.children.every(child => child.selected === false)) {
res = [...res, v];
} else {
res = [...res, ...this.getSelectedItems(v.children)];
}
}
} else if (v.hasChild) {
res = [...res, ...this.getSelectedItems(v.children)];
} else if (v.selected === true) {
res = [...res, v];
}
});
};
return res;
} else {
return [];
Expand Down

0 comments on commit 7f76f9f

Please sign in to comment.