From 490a10745790dc74934c18c8d32675e7e65a8b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 11 Jan 2022 23:08:57 +0100 Subject: [PATCH] Set expander to the first visible column issue11071 review380041002 --- src/view/tree.js | 92 +++++++++++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 32 deletions(-) diff --git a/src/view/tree.js b/src/view/tree.js index 657ac10444..e54813de55 100644 --- a/src/view/tree.js +++ b/src/view/tree.js @@ -202,6 +202,23 @@ this.table.append(this.tfoot); } + if (this.children_field) { + this.expander = jQuery('', { + 'class': 'expander', + }).append(jQuery('', { + 'tabindex': 0, + 'class': 'icon', + })); + this.update_expander('more'); + this.expander.on('click keypress', + Sao.common.click_press(this.unfold.bind(this))); + Sao.common.ICONFACTORY.get_icon_url( + 'tryton-unfold-' + this.expander.action) + .then(function(url) { + this.expander.children().attr('src', url); + }.bind(this)); + } + this.columns.forEach(function(column, i) { col = jQuery('', { 'class': column.attributes.widget, @@ -209,23 +226,6 @@ th = jQuery('', { 'class': column.attributes.widget, }); - if ((i === 0) && this.children_field) { - this.expander = jQuery('', { - 'tabindex': 0, - 'class': 'icon', - }); - this.update_expander('more'); - this.expander.on('click keypress', - Sao.common.click_press(this.unfold.bind(this))); - Sao.common.ICONFACTORY.get_icon_url( - 'tryton-unfold-' + this.expander.action) - .then(function(url) { - this.expander.attr('src', url); - }.bind(this)); - th.append(jQuery('', { - 'class': 'expander', - }).append(this.expander)); - } var label = jQuery('