diff options
| author | Aaron Bohy <aab@odoo.com> | 2020-07-16 15:07:08 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-07-17 11:58:27 +0000 |
| commit | 11b1b82c09950c7b13dc848b25d71d1499a5b711 (patch) | |
| tree | 80e5303f876424ae5ea194bb39c2d418b20aaa74 /addons/web/static/src/js/views/list | |
| parent | b2f8170d88239b5eaf04f1e3c0dcef613b78fedc (diff) | |
[FIX] web: list: do not crush text fields
Before this commit, it might happen that text field columns in list
views were completely crushed, to let space to the other columns.
This commit fixes the issue by preventing text fields from being
wrapped during the ideal column widths computation. Doing so, text
fields will take space they deserve according to their content.
They will then be wrapped if necessary, so that they aren't trimmed,
unlike e.g. char fields.
Task 2275747
closes odoo/odoo#54664
X-original-commit: 5c54111127bd99eedb4e0331aba5a0200feb461c
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views/list')
| -rw-r--r-- | addons/web/static/src/js/views/list/list_editable_renderer.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js index 1f13eabfa42..99bbcfbb814 100644 --- a/addons/web/static/src/js/views/list/list_editable_renderer.js +++ b/addons/web/static/src/js/views/list/list_editable_renderer.js @@ -1345,6 +1345,12 @@ ListRenderer.include({ */ _squeezeTable: function () { const table = this.el.getElementsByClassName('o_list_table')[0]; + + // Toggle a className used to remove style that could interfer with the ideal width + // computation algorithm (e.g. prevent text fields from being wrapped during the + // computation, to prevent them from being completely crushed) + table.classList.add('o_list_computing_widths'); + const thead = table.getElementsByTagName('thead')[0]; const thElements = [...thead.getElementsByTagName('th')]; const columnWidths = thElements.map(th => th.offsetWidth); @@ -1392,6 +1398,9 @@ ListRenderer.include({ totalWidth = getTotalWidth(); } + // We are no longer computing widths, so restore the normal style + table.classList.remove('o_list_computing_widths'); + return columnWidths; }, /** |
