[ADF-2123] Process Pagination - There is no way to paginate the result (#2946)

* [ADF- 2123] Process Pagination - There is no way to paginate the result

* Updated unimplemented pagination method.

* * Refactored process-service component.

* * Removed unused  pagination methods from process-service component.

* * Updated process/task list documentation with recent changes.
This commit is contained in:
siva kumar
2018-02-15 15:50:23 +05:30
committed by Eugenio Romano
parent f828e8e847
commit 1a41da514b
5 changed files with 37 additions and 24 deletions

View File

@@ -156,10 +156,6 @@
*ngIf="processList"
[target]="processList"
[supportedPageSizes]="supportedPages"
(changePageNumber)="onChangePageNumberProcess($event)"
(changePageSize)="onChangePageSizeProcess($event)"
(nextPage)="onNextPageProcess($event)"
(prevPage)="onPrevPageProcess($event)"
#processListPagination>
</adf-pagination>
</div>

View File

@@ -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;

View File

@@ -46,6 +46,25 @@ define custom schema in the app.config.json as shown below json format.
</adf-process-instance-list>
```
### Pagination strategy
adf-process-instance-list also supports pagination and the same can be used as shown below.
```html
<adf-process-instance-list
[appId]="'1'"
[page]="page"
[size]="size"
#processList>
</adf-process-instance-list>
<adf-pagination
*ngIf="processList"
[target]="processList"
[supportedPageSizes]="supportedPages"
#processListPagination>
</adf-pagination>
```
### 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)

View File

@@ -125,6 +125,8 @@ You can also use both HTML-based and app.config.json custom schema declaration a
</adf-tasklist>
```
### 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)

View File

@@ -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[] {