]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
copy KVComboBox.js from manager to manager5
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 27 Apr 2015 09:55:23 +0000 (11:55 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 27 Apr 2015 09:55:23 +0000 (11:55 +0200)
www/manager5/form/KVComboBox.js [new file with mode: 0644]

diff --git a/www/manager5/form/KVComboBox.js b/www/manager5/form/KVComboBox.js
new file mode 100644 (file)
index 0000000..cc25877
--- /dev/null
@@ -0,0 +1,44 @@
+Ext.define('PVE.form.KVComboBox', {
+    extend: 'Ext.form.field.ComboBox',
+    alias: 'widget.pveKVComboBox',
+
+    deleteEmpty: true,
+    
+    getSubmitData: function() {
+        var me = this,
+            data = null,
+            val;
+        if (!me.disabled && me.submitValue) {
+            val = me.getSubmitValue();
+            if (val !== null && val !== '') {
+                data = {};
+                data[me.getName()] = val;
+            } else if (me.deleteEmpty) {
+               data = {};
+                data['delete'] = me.getName();
+           }
+        }
+        return data;
+    },
+
+    initComponent: function() {
+       var me = this;
+
+       me.store = Ext.create('Ext.data.ArrayStore', {
+           model: 'KeyValue',
+           data : me.data
+       });
+
+       if (me.initialConfig.editable === undefined) {
+           me.editable = false;
+       }
+
+       Ext.apply(me, {
+           displayField: 'value',
+           valueField: 'key',
+           queryMode: 'local'
+       });
+
+       me.callParent();
+    }
+});