그룹 > 펼쳐놓고 그룹멤버 수정시 접히면서 스크롤이 하단에 유지되는 문제.

> 수정 후 scroll top으로.
This commit is contained in:
leejinho 2019-11-21 14:51:00 +09:00
parent a58423271d
commit 188b6e9823

View File

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