Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion addons/web/static/src/views/list/column_width_hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,13 @@ function computeOptimalDateWidths() {
*/
function computeWidths(table, state, allowedWidth, startingWidths) {
let _columnWidths;
const headers = [...table.querySelectorAll("thead th")];
const headers = [...table.querySelectorAll("thead th:not(.o_rowno)")];
const rowNum = table.classList.contains("o_rowno_in_tree")
const columns = state.columns;

if (rowNum && startingWidths)
startingWidths.shift();

// Starting point: compute widths
if (startingWidths) {
_columnWidths = startingWidths.slice();
Expand Down Expand Up @@ -207,6 +211,8 @@ function computeWidths(table, state, allowedWidth, startingWidths) {
// Expand/shrink columns for the table to fill 100% of available space
const totalWidth = _columnWidths.reduce((tot, width) => tot + width, 0);
let diff = totalWidth - allowedWidth;
if (rowNum)
diff += DEFAULT_MIN_WIDTH/2;
if (diff >= 1) {
// Case 1: table overflows its parent => shrink some columns
const shrinkableColumns = [];
Expand Down Expand Up @@ -278,6 +284,8 @@ function computeWidths(table, state, allowedWidth, startingWidths) {
}
}
}
if (rowNum)
_columnWidths.unshift(SELECTOR_WIDTH);
return _columnWidths;
}

Expand Down