resizeColGroup()

in sample/frontend/src/app/shared/fix/fix-table-primeng.directive.ts [161:177]


  resizeColGroup(table, resizeColumnIndex, newColumnWidth, delta, mode = 'fit') {
    if (table) {
      const colGroup = table.children[0].nodeName === 'COLGROUP' ? table.children[0] : null;

      if (colGroup) {
        const col = colGroup.children[resizeColumnIndex];
        const nextCol = colGroup.children[resizeColumnIndex + 1];
        col.style.width = (parseInt(col.style.width, 10) + delta) + 'px';

        if (nextCol && mode === 'fit') {
          nextCol.style.width = (parseInt(nextCol.style.width, 10) - delta) + 'px';
        }
      } else {
        throw new Error('Scrollable tables require a colgroup to support resizable columns');
      }
    }
  }