fix page size not being saved (#2429)

This commit is contained in:
Denys Vuika
2017-10-04 22:59:15 +01:00
committed by Eugenio Romano
parent 97d4ecd131
commit c9c22bc7c1

View File

@@ -20,7 +20,7 @@ import {
OnChanges, OnInit, Output, SimpleChanges, TemplateRef, ViewChild, ViewEncapsulation OnChanges, OnInit, Output, SimpleChanges, TemplateRef, ViewChild, ViewEncapsulation
} from '@angular/core'; } from '@angular/core';
import { MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging, Pagination, PersonEntry } from 'alfresco-js-api'; import { MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging, Pagination, PersonEntry } from 'alfresco-js-api';
import { AlfrescoApiService, AppConfigService, DataColumnListComponent } from 'ng2-alfresco-core'; import { AlfrescoApiService, AppConfigService, DataColumnListComponent, UserPreferencesService } from 'ng2-alfresco-core';
import { DataCellEvent, DataColumn, DataRowActionEvent, DataSorting, DataTableComponent, ObjectDataColumn } from 'ng2-alfresco-datatable'; import { DataCellEvent, DataColumn, DataRowActionEvent, DataSorting, DataTableComponent, ObjectDataColumn } from 'ng2-alfresco-datatable';
import { Observable, Subject } from 'rxjs/Rx'; import { Observable, Subject } from 'rxjs/Rx';
import { presetsDefaultModel } from '../models/preset.model'; import { presetsDefaultModel } from '../models/preset.model';
@@ -168,7 +168,8 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
private ngZone: NgZone, private ngZone: NgZone,
private elementRef: ElementRef, private elementRef: ElementRef,
private apiService: AlfrescoApiService, private apiService: AlfrescoApiService,
private appConfig: AppConfigService) { private appConfig: AppConfigService,
private preferences: UserPreferencesService) {
this.supportedPageSizes = appConfig.get('document-list.supportedPageSizes', [5, 10, 15, 20]); this.supportedPageSizes = appConfig.get('document-list.supportedPageSizes', [5, 10, 15, 20]);
} }
@@ -199,6 +200,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
} }
ngOnInit() { ngOnInit() {
this.pageSize = this.preferences.paginationSize;
this.loadLayoutPresets(); this.loadLayoutPresets();
this.data = new ShareDataTableAdapter(this.documentListService, null, this.getDefaultSorting()); this.data = new ShareDataTableAdapter(this.documentListService, null, this.getDefaultSorting());
this.data.thumbnails = this.thumbnails; this.data.thumbnails = this.thumbnails;
@@ -704,6 +706,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
} }
onChangePageSize(event: Pagination): void { onChangePageSize(event: Pagination): void {
this.preferences.paginationSize = event.maxItems;
this.pageSize = event.maxItems; this.pageSize = event.maxItems;
this.skipCount = 0; this.skipCount = 0;
this.reload(); this.reload();