diff --git a/demo-shell/src/app/components/process-service/process-service.component.html b/demo-shell/src/app/components/process-service/process-service.component.html index 5f9b878067..19c7c58443 100644 --- a/demo-shell/src/app/components/process-service/process-service.component.html +++ b/demo-shell/src/app/components/process-service/process-service.component.html @@ -156,10 +156,6 @@ *ngIf="processList" [target]="processList" [supportedPageSizes]="supportedPages" - (changePageNumber)="onChangePageNumberProcess($event)" - (changePageSize)="onChangePageSizeProcess($event)" - (nextPage)="onNextPageProcess($event)" - (prevPage)="onPrevPageProcess($event)" #processListPagination> diff --git a/demo-shell/src/app/components/process-service/process-service.component.ts b/demo-shell/src/app/components/process-service/process-service.component.ts index e4fbe79505..13b3ecb944 100644 --- a/demo-shell/src/app/components/process-service/process-service.component.ts +++ b/demo-shell/src/app/components/process-service/process-service.component.ts @@ -27,7 +27,7 @@ import { ViewEncapsulation } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { Pagination, ProcessInstanceFilterRepresentation } from 'alfresco-js-api'; +import { ProcessInstanceFilterRepresentation } from 'alfresco-js-api'; import { FORM_FIELD_VALIDATORS, FormEvent, FormFieldEvent, FormRenderingService, FormService, DynamicTableRow, ValidateDynamicTableRowEvent, AppConfigService, PaginationComponent @@ -200,25 +200,6 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit */ } - onPrevPageProcess(pagination: Pagination): void { - this.processPage = this.processListPagination.current - 1; - } - - onNextPageProcess(pagination: Pagination): void { - this.processPage = this.processListPagination.current - 1; - } - - onChangePageSizeProcess(pagination: Pagination): void { - const { maxItems } = pagination; - this.preferenceService.paginationSize = maxItems; - this.processPage = this.processListPagination.current - 1; - this.paginationPageSize = maxItems; - } - - onChangePageNumberProcess(pagination: Pagination): void { - this.processPage = this.processListPagination.current - 1; - } - ngOnInit() { if (this.router.url.includes('processes')) { this.activeTab = this.tabs.processes; diff --git a/docs/process-list.component.md b/docs/process-list.component.md index af86557381..16e4df37e7 100644 --- a/docs/process-list.component.md +++ b/docs/process-list.component.md @@ -46,6 +46,25 @@ define custom schema in the app.config.json as shown below json format. ``` +### Pagination strategy + +adf-process-instance-list also supports pagination and the same can be used as shown below. + +```html + + + + +``` + ### Properties | Name | Description | | | @@ -79,3 +98,8 @@ Example value for the schemaColumn property (see [Properties](#properties) secti {type: 'text', key: 'startedBy.email', title: 'Started By', sortable: true} ] ``` +## See also + +- [Data column component](data-column.component.md) +- [DataTableAdapter](DataTableAdapter.md) +- [Pagination component](pagination.component.md) \ No newline at end of file diff --git a/docs/task-list.component.md b/docs/task-list.component.md index 73a936ad28..8c905c467a 100644 --- a/docs/task-list.component.md +++ b/docs/task-list.component.md @@ -125,6 +125,8 @@ You can also use both HTML-based and app.config.json custom schema declaration a ``` +### Pagination strategy + adf-tasklist also supports pagination and the same can be used as shown below. ```html @@ -197,3 +199,4 @@ You can customize the styling of a column and also add features like tooltips an - [Data column component](data-column.component.md) - [DataTableAdapter](DataTableAdapter.md) +- [Pagination component](pagination.component.md) diff --git a/lib/process-services/process-list/components/process-list.component.ts b/lib/process-services/process-list/components/process-list.component.ts index f5c3c01b0d..faf5aec008 100644 --- a/lib/process-services/process-list/components/process-list.component.ts +++ b/lib/process-services/process-list/components/process-list.component.ts @@ -378,7 +378,16 @@ export class ProcessInstanceListComponent implements OnChanges, AfterContentInit } updatePagination(params: PaginationQueryParams) { + const needsReload = params.maxItems || params.skipCount; + this.size = params.maxItems; + this.page = this.currentPage(params.skipCount, params.maxItems); + if (needsReload) { + this.reload(); + } + } + currentPage(skipCount: number, maxItems: number): number { + return (skipCount && maxItems) ? Math.floor(skipCount / maxItems) : 0; } get supportedPageSizes(): number[] {