Commit 8fde7805 authored by Emmanuel Kasper's avatar Emmanuel Kasper Committed by Dietmar Maurer

Pass the list of of combobox items as a property

The original fix using a config Object was a bit overkill, this works well too , requires less code in the child classes, and is more consistent with rest of the code we have.
parent aaf8444c
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
* *
* config properties: * config properties:
* comboItems: an array of Key - Value pairs * comboItems: an array of Key - Value pairs
* deleteEmpty: if set to true (default), an empty value received from the
* comboBox will reset the property to its default value
*/ */
Ext.define('PVE.form.KVComboBox', { Ext.define('PVE.form.KVComboBox', {
extend: 'Ext.form.field.ComboBox', extend: 'Ext.form.field.ComboBox',
alias: 'widget.pveKVComboBox', alias: 'widget.pveKVComboBox',
deleteEmpty: true, deleteEmpty: true,
config: { comboItems: undefined,
comboItems: undefined
},
getSubmitData: function() { getSubmitData: function() {
var me = this, var me = this,
...@@ -22,9 +22,9 @@ Ext.define('PVE.form.KVComboBox', { ...@@ -22,9 +22,9 @@ Ext.define('PVE.form.KVComboBox', {
data = {}; data = {};
data[me.getName()] = val; data[me.getName()] = val;
} else if (me.deleteEmpty) { } else if (me.deleteEmpty) {
data = {}; data = {};
data['delete'] = me.getName(); data['delete'] = me.getName();
} }
} }
return data; return data;
}, },
...@@ -34,7 +34,7 @@ Ext.define('PVE.form.KVComboBox', { ...@@ -34,7 +34,7 @@ Ext.define('PVE.form.KVComboBox', {
me.store = Ext.create('Ext.data.ArrayStore', { me.store = Ext.create('Ext.data.ArrayStore', {
model: 'KeyValue', model: 'KeyValue',
data : me.getConfig('comboItems'), data : me.comboItems,
}); });
if (me.initialConfig.editable === undefined) { if (me.initialConfig.editable === undefined) {
......
Ext.define('PVE.form.LanguageSelector', { Ext.define('PVE.form.LanguageSelector', {
extend: 'PVE.form.KVComboBox', extend: 'PVE.form.KVComboBox',
alias: ['widget.pveLanguageSelector'], alias: ['widget.pveLanguageSelector'],
config: { comboItems: PVE.Utils.language_array()
comboItems: PVE.Utils.language_array()
}
}); });
Ext.define('PVE.form.VNCKeyboardSelector', { Ext.define('PVE.form.VNCKeyboardSelector', {
extend: 'PVE.form.KVComboBox', extend: 'PVE.form.KVComboBox',
alias: ['widget.VNCKeyboardSelector'], alias: ['widget.VNCKeyboardSelector'],
config: { comboItems: PVE.Utils.kvm_keymap_array()
comboItems: PVE.Utils.kvm_keymap_array()
}
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment