Skip to content

Commit 2c893ea

Browse files
authored
Merge pull request #3260 from IgniteUI/vNext
merge vNext into master
2 parents a777363 + a8e0487 commit 2c893ea

5 files changed

Lines changed: 628 additions & 39 deletions

File tree

src/app/data-entries/dropdown/dropdown-tree-grid-hierarchical-selection/dropdown-tree-grid-hierarchical-selection.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export class DropdownTreeGridHierarchicalSelectionComponent implements OnInit {
1717

1818
public ngOnInit(): void {
1919
this.employees = EMPLOYEE_DATA;
20+
21+
this.igxTreeGrid.selectRows([1,4], true);
22+
this.selectedRows = [];
23+
this.igxTreeGrid.selectedRows.forEach((row) => this.selectedRows.push(this.employees.find(employee => employee.ID == row)));
2024
}
2125

2226
public onRowSelectionChanging(args: IRowSelectionEventArgs, grid: IgxTreeGridComponent) {
@@ -34,6 +38,6 @@ export class DropdownTreeGridHierarchicalSelectionComponent implements OnInit {
3438
}
3539

3640
public handleClosing(event: IBaseCancelableBrowserEventArgs) {
37-
event.cancel = event.event.composedPath().some(e => (e as HTMLElement).nodeName.toLowerCase() === 'igx-chip');
41+
event.cancel = event.event.composedPath().some(e => (e as HTMLElement).nodeName?.toLowerCase() === 'igx-chip');
3842
}
3943
}

src/app/data-entries/dropdown/dropdown-tree-hierarchical-selection/dropdown-tree-hierarchical-selection.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<igx-drop-down #countriesDropDown [height]="'500px'" [width]="'300px'" (closing)="handleClosing($event)">
1313
<igx-tree #igxTree selection="BiState" (nodeSelection)="onNodeSelection($event)">
14-
<igx-tree-node *ngFor="let country of countries" [data]="country" [expanded]="true">
14+
<igx-tree-node *ngFor="let country of countries" [data]="country" [expanded]="true" [selected]="true">
1515
{{ country.Name }}
1616
<igx-tree-node *ngFor="let city of country.Cities" [data]="city">
1717
{{ city.Name }}

src/app/data-entries/dropdown/dropdown-tree-hierarchical-selection/dropdown-tree-hierarchical-selection.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Component, OnInit, ViewChild } from '@angular/core';
2-
import { IBaseChipEventArgs, IgxChipComponent, IgxTreeComponent, ITreeNodeSelectionEvent } from 'igniteui-angular';
1+
import { Component, DoCheck, OnInit, ViewChild } from '@angular/core';
2+
import { IBaseChipEventArgs, IgxTreeComponent, ITreeNodeSelectionEvent } from 'igniteui-angular';
33
import { IBaseCancelableBrowserEventArgs } from 'igniteui-angular/lib/core/utils';
44
import { COUNTRIES } from './countries';
55
@Component({
@@ -8,7 +8,7 @@ import { COUNTRIES } from './countries';
88
styleUrls: ['./dropdown-tree-hierarchical-selection.component.scss'],
99
templateUrl: './dropdown-tree-hierarchical-selection.component.html'
1010
})
11-
export class DropdownTreeHierarchicalSelectionComponent implements OnInit {
11+
export class DropdownTreeHierarchicalSelectionComponent implements OnInit, DoCheck {
1212
@ViewChild('igxTree', { static: true })
1313
public igxTree: IgxTreeComponent;
1414

@@ -19,6 +19,10 @@ export class DropdownTreeHierarchicalSelectionComponent implements OnInit {
1919
this.countries = COUNTRIES;
2020
}
2121

22+
public ngDoCheck(){
23+
this.selectedNodes = this.igxTree.nodes?.filter(node => node.selected == true);
24+
}
25+
2226
public onNodeSelection(args: ITreeNodeSelectionEvent) {
2327
this.selectedNodes = args.newSelection;
2428
}
@@ -33,6 +37,6 @@ export class DropdownTreeHierarchicalSelectionComponent implements OnInit {
3337
}
3438

3539
public handleClosing(event: IBaseCancelableBrowserEventArgs) {
36-
event.cancel = event.event.composedPath().some(e => (e as HTMLElement).nodeName.toLowerCase() === 'igx-chip');
40+
event.cancel = event.event.composedPath().some(e => (e as HTMLElement).nodeName?.toLowerCase() === 'igx-chip');
3741
}
3842
}

0 commit comments

Comments
 (0)