mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
AAE-13310: update and preserve column width preferences only on visible columns (#8488)
* AAE-13310: update and preserve column width preferences only on visible columns * AAE-13310: Fixing lint issues
This commit is contained in:
@@ -1968,6 +1968,38 @@ describe('Column Resizing', () => {
|
||||
expect(adapter.setColumns).toHaveBeenCalledWith(columns);
|
||||
}));
|
||||
|
||||
it('should set column widths while resizing ONLY on visible columns', fakeAsync(() => {
|
||||
const adapter = dataTable.data;
|
||||
spyOn(adapter, 'getColumns').and.returnValue([
|
||||
{
|
||||
key: 'name',
|
||||
type: 'text',
|
||||
width: 110,
|
||||
isHidden: true
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
type: 'text',
|
||||
width: 120,
|
||||
isHidden: false
|
||||
},
|
||||
{
|
||||
key: 'created',
|
||||
type: 'text',
|
||||
width: 150
|
||||
}
|
||||
]);
|
||||
spyOn(adapter, 'setColumns').and.callThrough();
|
||||
|
||||
dataTable.onResizing({ rectangle: { top: 0, bottom: 10, left: 0, right: 20, width: 65 } }, 0);
|
||||
tick();
|
||||
|
||||
expect(adapter.setColumns).toHaveBeenCalledWith([
|
||||
{ key: 'status', type: 'text', width: 65, isHidden: false },
|
||||
{ key: 'created', type: 'text', width: 150 }
|
||||
]);
|
||||
}));
|
||||
|
||||
it('should set the column header style on resizing', fakeAsync(() => {
|
||||
dataTable.onResizing({ rectangle: { top: 0, bottom: 10, left: 0, right: 20, width: 125 } }, 0);
|
||||
tick();
|
||||
|
@@ -950,7 +950,7 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
|
||||
|
||||
onResizing({ rectangle: { width } }: ResizeEvent, colIndex: number): void {
|
||||
const timeoutId = setTimeout(() => {
|
||||
const allColumns = this.data.getColumns();
|
||||
const allColumns = this.data.getColumns().filter(column => !column.isHidden);
|
||||
allColumns[colIndex].width = width;
|
||||
this.data.setColumns(allColumns);
|
||||
|
||||
|
Reference in New Issue
Block a user