From 31c9a33bcc6b19e38421d0909ab864603f094bcb Mon Sep 17 00:00:00 2001 From: Alex Molodyh Date: Tue, 26 Nov 2024 14:02:16 -0800 Subject: [PATCH] [AAE-22900] PR comments update - exposed sortingMode as public for testing --- .../lib/datatable/data/object-datatable-adapter.ts | 14 +++++++++++++- .../process-list-datatable-adapter.spec.ts | 2 +- .../datatable/task-list-datatable-adapter.spec.ts | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/core/src/lib/datatable/data/object-datatable-adapter.ts b/lib/core/src/lib/datatable/data/object-datatable-adapter.ts index 91df269832..2c3d727189 100644 --- a/lib/core/src/lib/datatable/data/object-datatable-adapter.ts +++ b/lib/core/src/lib/datatable/data/object-datatable-adapter.ts @@ -30,7 +30,7 @@ export class ObjectDataTableAdapter implements DataTableAdapter { private _sorting: DataSorting; private _rows: DataRow[]; private _columns: DataColumn[]; - private readonly _sortingMode: SortingMode; + private _sortingMode: SortingMode; selectedRow: DataRow; rowsChanged: Subject>; @@ -57,6 +57,17 @@ export class ObjectDataTableAdapter implements DataTableAdapter { return schema; } + get sortingMode(): SortingMode { + return this._sortingMode; + } + set sortingMode(sortingMode: SortingMode) { + if (!sortingMode) { + sortingMode = 'client'; + } + + this._sortingMode = sortingMode; + } + constructor(data: any[] = [], schema: DataColumn[] = [], sortingMode: SortingMode = 'client') { this._rows = []; this._columns = []; @@ -64,6 +75,7 @@ export class ObjectDataTableAdapter implements DataTableAdapter { if (!sortingMode) { sortingMode = 'client'; } + this._sortingMode = sortingMode; if (data && data.length > 0) { this._rows = data.map((item) => new ObjectDataRow(item)); diff --git a/lib/process-services-cloud/src/lib/process/process-list/datatable/process-list-datatable-adapter.spec.ts b/lib/process-services-cloud/src/lib/process/process-list/datatable/process-list-datatable-adapter.spec.ts index 4164df4792..0eec642188 100644 --- a/lib/process-services-cloud/src/lib/process/process-list/datatable/process-list-datatable-adapter.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-list/datatable/process-list-datatable-adapter.spec.ts @@ -53,6 +53,6 @@ describe('ProcessListDatatableAdapter', () => { it('should initialize constructor with server sortingMode', () => { const adapter = new ProcessListDatatableAdapter([], []); - expect(adapter['_sortingMode']).toBe('server'); + expect(adapter.sortingMode).toBe('server'); }); }); diff --git a/lib/process-services-cloud/src/lib/task/task-list/datatable/task-list-datatable-adapter.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/datatable/task-list-datatable-adapter.spec.ts index 16a9089eb3..dfc364ca88 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/datatable/task-list-datatable-adapter.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/datatable/task-list-datatable-adapter.spec.ts @@ -63,6 +63,6 @@ describe('TasksListDatatableAdapter', () => { it('should initialize constructor with server sortingMode', () => { const adapter = new TasksListDatatableAdapter([], []); - expect(adapter['_sortingMode']).toBe('server'); + expect(adapter.sortingMode).toBe('server'); }); });