jsdialog: keep icons column in line with header

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I2ed3b97dced0e0be686a602de9dda05a3322745e
This commit is contained in:
Szymon Kłos 2022-12-16 10:46:52 +01:00 committed by Szymon Kłos
parent 82205c98e1
commit b70f6e6213

View file

@ -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) { function _createHeaders(tbody, data, builder) {
var headers = L.DomUtil.create('tr', builder.options.cssClass + ' ui-treeview-header', tbody); 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; var hasCheckboxes = data.entries && data.entries.length && data.entries[0].state !== undefined;
if (hasCheckboxes) if (hasCheckboxes)
data.headers = [{ text: '' }].concat(data.headers); 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) { for (var h in data.headers) {
var header = L.DomUtil.create('th', builder.options.cssClass, 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); var headerText = L.DomUtil.create('span', builder.options.cssClass + ' ui-treeview-header-text', header);