diff options
| author | Tiffany Chang (tic) <tic@odoo.com> | 2020-03-27 17:48:28 +0000 |
|---|---|---|
| committer | Tiffany Chang (tic) <tic@odoo.com> | 2020-03-31 10:31:35 +0000 |
| commit | 69e5f59005b403cb8624b21b0227830d58cf7b2a (patch) | |
| tree | 124b6f00d31624e1564335fe319f0d086c5a5087 /addons/web/static/src/js | |
| parent | fe41c92771f0276714a7d1d38deba7aa36209c35 (diff) | |
[IMP] web: scope list table selection
Prior to this commit, the list_editable_renderer was grabbing the first
table in the DOM. This made it so extending list views with another table
could cause the new table to resize unexpectedly when changing the column
width of the list view generated table (i.e. o_list_table).
While this double table situation may not arise very often, it directly
hindered task: 2198420 and may hinder other customized view tasks.
Related to task: 2198420
("Requests for Quotations KPI's" subsection)
closes odoo/odoo#46654
Related: odoo/upgrade#877
Related: odoo/enterprise#8945
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/views/list/list_editable_renderer.js | 8 |
1 files changed, 4 insertions, 4 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 8cd7f5a370d..684fe62465e 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 @@ -663,7 +663,7 @@ ListRenderer.include({ if (!thElements.length) { return; } - const table = this.el.getElementsByTagName('table')[0]; + const table = this.el.getElementsByClassName('o_list_table')[0]; let columnWidths = this.columnWidths; if (!columnWidths || !columnWidths.length) { // no column widths to restore @@ -1228,7 +1228,7 @@ ListRenderer.include({ _renderView: function () { this.currentRow = null; return this._super.apply(this, arguments).then(() => { - const table = this.el.getElementsByTagName('table')[0]; + const table = this.el.getElementsByClassName('o_list_table')[0]; if (table) { table.classList.toggle('o_empty_list', !this._hasVisibleRecords(this.state)); this._freezeColumnWidths(); @@ -1341,7 +1341,7 @@ ListRenderer.include({ * overflow */ _squeezeTable: function () { - const table = this.el.getElementsByTagName('table')[0]; + const table = this.el.getElementsByClassName('o_list_table')[0]; const thead = table.getElementsByTagName('thead')[0]; const thElements = [...thead.getElementsByTagName('th')]; const columnWidths = thElements.map(th => th.offsetWidth); @@ -1684,7 +1684,7 @@ ListRenderer.include({ this.isResizing = true; - const table = this.el.getElementsByTagName('table')[0]; + const table = this.el.getElementsByClassName('o_list_table')[0]; const th = ev.target.closest('th'); table.style.width = `${table.offsetWidth}px`; const thPosition = [...th.parentNode.children].indexOf(th); |
