diff --git a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts index 4d2382c6..8c4f1aef 100644 --- a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts +++ b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts @@ -26,6 +26,7 @@ import { NGXLogger } from 'ngx-logger'; import { VirtualScrollTreeFlatDataSource } from '@ucap-webmessenger/ui'; import { FlatTreeControl } from '@angular/cdk/tree'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; +import { PerfectScrollbarDirective } from 'ngx-perfect-scrollbar'; enum NodeType { None = 'None', @@ -116,6 +117,10 @@ export class ExpansionPanelComponent children: [] }; + item.buddyList.sort((a, b) => + a.name < b.name ? -1 : a.name > b.name ? 1 : 0 + ); + item.buddyList.forEach(userInfo => { groupNode.children.push({ nodeType: NodeType.Buddy, @@ -160,6 +165,9 @@ export class ExpansionPanelComponent @ViewChild('cvsvGroup', { static: false }) cvsvGroup: CdkVirtualScrollViewport; + @ViewChild('cvsvGroup', { read: PerfectScrollbarDirective, static: false }) + perfectScrollbar: PerfectScrollbarDirective; + NodeType = NodeType; profileNodes: GroupNode[] = []; @@ -270,5 +278,9 @@ export class ExpansionPanelComponent ...this.buddyNodes ]; this.dataSource.data = this.rootNodeList; + + if (!!this.perfectScrollbar) { + this.perfectScrollbar.scrollToTop(); + } } }