Skip to content

Commit

Permalink
[AAE-22900] PR comments update - exposed sortingMode as public for te…
Browse files Browse the repository at this point in the history
…sting
  • Loading branch information
amolodyh-hyland committed Nov 26, 2024
1 parent 8b6ddcc commit 31c9a33
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion lib/core/src/lib/datatable/data/object-datatable-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Array<DataRow>>;
Expand All @@ -57,13 +57,25 @@ 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 = [];

if (!sortingMode) {
sortingMode = 'client';
}
this._sortingMode = sortingMode;

if (data && data.length > 0) {
this._rows = data.map((item) => new ObjectDataRow(item));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});

0 comments on commit 31c9a33

Please sign in to comment.