65528: ComCol Tree with full FlatList that gets generated at page-load

This commit is contained in:
Marie Verdonck
2019-10-09 18:06:51 +02:00
parent 2d50598177
commit 4feba32157
14 changed files with 287 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import {Component, OnInit} from '@angular/core';
import {CommunityListService} from '../CommunityListService';
import {CommunityFlatNode, CommunityListDataSource} from '../CommunityListDataSource';
import {FlatTreeControl} from '@angular/cdk/tree';
@Component({
selector: 'ds-community-list',
templateUrl: './community-list.component.html',
styleUrls: ['./community-list.component.css']
})
export class CommunityListComponent implements OnInit {
treeControl = new FlatTreeControl<CommunityFlatNode>(
(node) => node.level, (node) => node.expandable
);
dataSource: CommunityListDataSource;
constructor(private communityListService: CommunityListService) { }
ngOnInit() {
this.dataSource = new CommunityListDataSource(this.communityListService);
this.dataSource.loadCommunities();
}
hasChild = (_: number, node: CommunityFlatNode) => node.expandable;
shouldRender(node: CommunityFlatNode) {
const parent = node.parent;
return !parent || parent.isExpanded;
}
numberReturn(length){
return new Array(length);
}
}