mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
70599: Improvements comcol tree
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../core/data/request.models';
|
||||
import { CommunityListService, FlatNode } from '../community-list-service';
|
||||
import { CommunityListDatasource } from '../community-list-datasource';
|
||||
import { FlatTreeControl } from '@angular/cdk/tree';
|
||||
@@ -27,7 +29,13 @@ export class CommunityListComponent implements OnInit, OnDestroy {
|
||||
|
||||
dataSource: CommunityListDatasource;
|
||||
|
||||
paginationConfig: FindListOptions;
|
||||
|
||||
constructor(private communityListService: CommunityListService) {
|
||||
this.paginationConfig = new FindListOptions();
|
||||
this.paginationConfig.elementsPerPage = 2;
|
||||
this.paginationConfig.currentPage = 1;
|
||||
this.paginationConfig.sort = new SortOptions('dc.title', SortDirection.ASC);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -37,7 +45,7 @@ export class CommunityListComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
this.communityListService.getExpandedNodesFromStore().pipe(take(1)).subscribe((result) => {
|
||||
this.expandedNodes = [...result];
|
||||
this.dataSource.loadCommunities(this.expandedNodes);
|
||||
this.dataSource.loadCommunities(this.paginationConfig, this.expandedNodes);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -74,7 +82,7 @@ export class CommunityListComponent implements OnInit, OnDestroy {
|
||||
node.currentCommunityPage = 1;
|
||||
}
|
||||
}
|
||||
this.dataSource.loadCommunities(this.expandedNodes);
|
||||
this.dataSource.loadCommunities(this.paginationConfig, this.expandedNodes);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,10 +102,10 @@ export class CommunityListComponent implements OnInit, OnDestroy {
|
||||
const parentNodeInExpandedNodes = this.expandedNodes.find((node2: FlatNode) => node.parent.id === node2.id);
|
||||
parentNodeInExpandedNodes.currentCommunityPage++;
|
||||
}
|
||||
this.dataSource.loadCommunities(this.expandedNodes);
|
||||
this.dataSource.loadCommunities(this.paginationConfig, this.expandedNodes);
|
||||
} else {
|
||||
this.communityListService.getNextPageTopCommunities();
|
||||
this.dataSource.loadCommunities(this.expandedNodes);
|
||||
this.paginationConfig.currentPage++;
|
||||
this.dataSource.loadCommunities(this.paginationConfig, this.expandedNodes);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user