make admin users table resizable

This commit is contained in:
2023-08-29 14:23:06 +02:00
parent d0c40e1d81
commit 8259c387e5
3 changed files with 79 additions and 32 deletions

View File

@ -21,17 +21,21 @@ export function resizeTableColumn(event: MouseEvent, dragOffset: number) {
const table = element.parentElement!.parentElement!.parentElement as HTMLTableElement;
let resizeRow: HTMLTableRowElement;
if (table.tBodies[0].rows[0].hidden) {
resizeRow = table.rows[0];
if (table.tBodies[0].rows[0].hasAttribute('resize-row')) {
resizeRow = table.tBodies[0].rows[0];
} else {
resizeRow = table.tBodies[0].insertRow(0);
resizeRow.hidden = true;
resizeRow.setAttribute('resize-row', '');
resizeRow.style.height = '0';
resizeRow.style.border = '0';
resizeRow.style.overflow = 'hidden';
for (let i = 0; i < table.rows[0].cells.length; i++) {
resizeRow.insertCell();
const cell = resizeRow.insertCell();
cell.style.padding = '0';
}
// insert an additional to keep the zebra in place pattern which might be applied
const zebraGhostRow = table.tBodies[0].insertRow(0);
const zebraGhostRow = table.tBodies[0].insertRow(1);
zebraGhostRow.hidden = true;
}