grid/ObjectGrid.js: new helper add_combobox_row()

This commit is contained in:
Dietmar Maurer 2017-03-01 07:44:58 +01:00
parent cc315e82e8
commit 8f7370eea1

View File

@ -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),