in sample/frontend/src/app/shared/fix/fix-table-primeng.directive.ts [27:94]
onColumnResizeEnd(event, column) {
let delta = this.table.resizeHelperViewChild.nativeElement.offsetLeft - this.table.lastResizerHelperX;
const columnWidth = column.offsetWidth;
const minWidth = parseInt(column.style.minWidth || 15, 10);
if (columnWidth + delta < minWidth) {
delta = minWidth - columnWidth;
}
const newColumnWidth = columnWidth + delta;
if (newColumnWidth >= minWidth) {
if (this.table.columnResizeMode === 'fit') {
let nextColumn = column.nextElementSibling;
const colspan = nextColumn.colSpan || 0;
while (!nextColumn.offsetParent) {
nextColumn = nextColumn.nextElementSibling;
}
if (nextColumn) {
const nextColumnWidth = nextColumn.offsetWidth - delta;
const nextColumnMinWidth = nextColumn.style.minWidth || 15;
if (newColumnWidth > 15 && nextColumnWidth > parseInt(nextColumnMinWidth, 10)) {
if (this.table.scrollable) {
const scrollableView = this.table.findParentScrollableView(column);
const scrollableBodyTable = DomHandler.findSingle(scrollableView, '.ui-table-scrollable-body table');
const scrollableHeaderTable = DomHandler.findSingle(scrollableView, 'table.ui-table-scrollable-header-table');
const scrollableFooterTable = DomHandler.findSingle(scrollableView, 'table.ui-table-scrollable-footer-table');
const resizeColumnIndex = this.indexColumn(column);
this.resizeColGroup(scrollableHeaderTable, resizeColumnIndex, newColumnWidth, delta, this.table.columnResizeMode);
this.resizeColGroup(scrollableBodyTable, resizeColumnIndex, newColumnWidth, delta, this.table.columnResizeMode);
this.resizeColGroup(scrollableFooterTable, resizeColumnIndex, newColumnWidth, delta, this.table.columnResizeMode);
} else {
column.style.width = newColumnWidth + 'px';
if (nextColumn) {
nextColumn.style.width = nextColumnWidth + 'px';
}
}
}
}
} else if (this.table.columnResizeMode === 'expand') {
if (newColumnWidth >= minWidth) {
if (this.table.scrollable) {
this.setScrollableItemsWidthOnExpandResize(column, newColumnWidth, delta);
} else {
// this.table.tableViewChild.nativeElement.style.width = this.table.tableViewChild.nativeElement.offsetWidth + delta + 'px';
column.style.width = newColumnWidth + 'px';
// const containerWidth = this.table.tableViewChild.nativeElement.style.width;
// this.table.containerViewChild.nativeElement.style.width = containerWidth + 'px';
}
}
}
this.table.onColResize.emit({
element: column,
delta
});
if (this.table.isStateful()) {
this.table.saveState();
}
}
this.table.resizeHelperViewChild.nativeElement.style.display = 'none';
DomHandler.removeClass(this.table.containerViewChild.nativeElement, 'p-unselectable-text');
}