mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-28 20:39:32 +00:00
utils: add updateColumnWidth helper from PVE
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
e662b4a0b8
commit
4febc669d5
30
Utils.js
30
Utils.js
@ -477,6 +477,36 @@ Ext.define('Proxmox.Utils', { utilities: {
|
||||
}
|
||||
},
|
||||
|
||||
updateColumnWidth: function(container) {
|
||||
let mode = Ext.state.Manager.get('summarycolumns') || 'auto';
|
||||
let factor;
|
||||
if (mode !== 'auto') {
|
||||
factor = parseInt(mode, 10);
|
||||
if (Number.isNaN(factor)) {
|
||||
factor = 1;
|
||||
}
|
||||
} else {
|
||||
factor = container.getSize().width < 1600 ? 1 : 2;
|
||||
}
|
||||
|
||||
if (container.oldFactor === factor) {
|
||||
return;
|
||||
}
|
||||
|
||||
let items = container.query('>'); // direct childs
|
||||
factor = Math.min(factor, items.length);
|
||||
container.oldFactor = factor;
|
||||
|
||||
items.forEach((item) => {
|
||||
item.columnWidth = 1 / factor;
|
||||
});
|
||||
|
||||
// we have to update the layout twice, since the first layout change
|
||||
// can trigger the scrollbar which reduces the amount of space left
|
||||
container.updateLayout();
|
||||
container.updateLayout();
|
||||
},
|
||||
|
||||
dialog_title: function(subject, create, isAdd) {
|
||||
if (create) {
|
||||
if (isAdd) {
|
||||
|
Loading…
Reference in New Issue
Block a user