This commit is contained in:
leejh 2019-10-31 10:26:55 +09:00
commit 069d39aa8f

View File

@ -5,7 +5,8 @@ import {
ChangeDetectorRef, ChangeDetectorRef,
ViewChild, ViewChild,
Output, Output,
EventEmitter EventEmitter,
AfterViewInit
} from '@angular/core'; } from '@angular/core';
import { DeptInfo } from '@ucap-webmessenger/protocol-query'; import { DeptInfo } from '@ucap-webmessenger/protocol-query';
import { MatTreeNestedDataSource, MatTree } from '@angular/material'; import { MatTreeNestedDataSource, MatTree } from '@angular/material';
@ -45,7 +46,7 @@ export class OraganizationNode {
templateUrl: './tree.component.html', templateUrl: './tree.component.html',
styleUrls: ['./tree.component.scss'] styleUrls: ['./tree.component.scss']
}) })
export class TreeComponent implements OnInit { export class TreeComponent implements OnInit, AfterViewInit {
@Output() @Output()
selected = new EventEmitter<DeptInfo>(); selected = new EventEmitter<DeptInfo>();
@ -82,6 +83,7 @@ export class TreeComponent implements OnInit {
}); });
this.dataSource.data = rootNodeList; this.dataSource.data = rootNodeList;
this.treeControl.expand(this.dataSource.data[0]);
} }
@ViewChild('orgranizationTree', { static: true }) @ViewChild('orgranizationTree', { static: true })
@ -104,6 +106,8 @@ export class TreeComponent implements OnInit {
ngOnInit() {} ngOnInit() {}
ngAfterViewInit(): void {}
getChildren = (node: OraganizationNode) => node.children; getChildren = (node: OraganizationNode) => node.children;
hasChildren = (index: number, node: OraganizationNode) => hasChildren = (index: number, node: OraganizationNode) =>