From b70f6e62135cab9300d04714455e8cfe114c21f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Fri, 16 Dec 2022 10:46:52 +0100 Subject: [PATCH] jsdialog: keep icons column in line with header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Szymon Kłos Change-Id: I2ed3b97dced0e0be686a602de9dda05a3322745e --- browser/src/control/jsdialog/Widget.TreeView.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/browser/src/control/jsdialog/Widget.TreeView.js b/browser/src/control/jsdialog/Widget.TreeView.js index 44491a54d..79407acef 100644 --- a/browser/src/control/jsdialog/Widget.TreeView.js +++ b/browser/src/control/jsdialog/Widget.TreeView.js @@ -224,11 +224,21 @@ function _headerlistboxEntry(parentContainer, treeViewData, entry, builder) { } } +function _hasIcon(columns) { + for (var i in columns) + if (columns[i].collapsed !== undefined) + return true; + return false; +} + function _createHeaders(tbody, data, builder) { var headers = L.DomUtil.create('tr', builder.options.cssClass + ' ui-treeview-header', tbody); var hasCheckboxes = data.entries && data.entries.length && data.entries[0].state !== undefined; if (hasCheckboxes) data.headers = [{ text: '' }].concat(data.headers); + var hasIcons = data.entries && data.entries.length && _hasIcon(data.entries[0].columns); + if (hasIcons) + data.headers = [{ text: '' }].concat(data.headers); for (var h in data.headers) { var header = L.DomUtil.create('th', builder.options.cssClass, headers); var headerText = L.DomUtil.create('span', builder.options.cssClass + ' ui-treeview-header-text', header);