Commit bf6b27eb authored by Emmanuel Kasper's avatar Emmanuel Kasper Committed by Dietmar Maurer

ext5migrate: pass the items we want in the ComboBox as a config property

Since ExtJS5, when doing such a declaration,

	Ext.applyIf(me, {
	    items: {
		xtype: 'pveKVComboBox',
		comboItems: data,
	    }
	});

the comboItems property is passed in the parent class as a config object,
instead of being directly available via this.comboItems

Since using a config object is the recommended way of passing parameters
int the ExtJS class model, adapt the parent class to use the new paradigm.
parent 31b275d9
...@@ -62,9 +62,9 @@ Ext.define('PVE.dc.ConsoleViewerEdit', { ...@@ -62,9 +62,9 @@ Ext.define('PVE.dc.ConsoleViewerEdit', {
items: { items: {
xtype: 'pveKVComboBox', xtype: 'pveKVComboBox',
name: 'console', name: 'console',
data: data,
value: '', value: '',
fieldLabel: gettext('Console Viewer') fieldLabel: gettext('Console Viewer'),
comboItems: data,
} }
}); });
......
/* Key-Value ComboBox
*
* config properties:
* comboItems: an array of Key - Value pairs
*/
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
},
getSubmitData: function() { getSubmitData: function() {
var me = this, var me = this,
...@@ -26,7 +34,7 @@ Ext.define('PVE.form.KVComboBox', { ...@@ -26,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.data data : me.getConfig('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: {
initComponent: function() { comboItems: PVE.Utils.language_array()
var me = this;
me.data = PVE.Utils.language_array();
me.callParent();
} }
}); });
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: {
initComponent: function() { comboItems: PVE.Utils.kvm_keymap_array()
var me = this;
me.data = PVE.Utils.kvm_keymap_array();
me.callParent();
} }
}); });
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