From 8f7370eea17f37b6d145b05a514b10a5103cc2dd Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 1 Mar 2017 07:44:58 +0100 Subject: [PATCH] grid/ObjectGrid.js: new helper add_combobox_row() --- grid/ObjectGrid.js | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/grid/ObjectGrid.js b/grid/ObjectGrid.js index e19bcb1..7463485 100644 --- a/grid/ObjectGrid.js +++ b/grid/ObjectGrid.js @@ -22,6 +22,35 @@ Ext.define('Proxmox.grid.ObjectGrid', { disabled: false, hideHeaders: true, + add_combobox_row: function(name, text, opts) { + var me = this; + + opts = opts || {}; + me.rows = me.rows || {}; + + me.rows[name] = { + required: true, + defaultValue: opts.defaultValue, + header: text, + renderer: opts.renderer, + editor: { + xtype: 'proxmoxWindowEdit', + subject: text, + items: { + xtype: 'proxmoxKVComboBox', + name: name, + comboItems: opts.comboItems, + value: opts.defaultValue, + deleteEmpty: opts.deleteEmpty ? true : false, + emptyText: opts.defaultValue, + labelWidth: Proxmox.Utils.compute_min_label_width( + text, opts.labelWidth), + fieldLabel: text + } + } + }; + }, + add_text_row: function(name, text, opts) { var me = this; @@ -39,7 +68,7 @@ Ext.define('Proxmox.grid.ObjectGrid', { items: { xtype: 'proxmoxtextfield', name: name, - deleteEmpty: true, + deleteEmpty: opts.deleteEmpty ? true : false, emptyText: opts.defaultValue, labelWidth: Proxmox.Utils.compute_min_label_width( text, opts.labelWidth), @@ -97,7 +126,7 @@ Ext.define('Proxmox.grid.ObjectGrid', { minValue: opts.minValue, maxValue: opts.maxValue, emptyText: gettext('Default'), - deleteEmpty: true, + deleteEmpty: opts.deleteEmpty ? true : false, value: opts.defaultValue, labelWidth: Proxmox.Utils.compute_min_label_width( text, opts.labelWidth),