]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - form/KVComboBox.js
d8167ac2b6286300d027545eb0300ccb26255901
4 * comboItems: an array of Key - Value pairs
5 * deleteEmpty: if set to true (default), an empty value received from the
6 * comboBox will reset the property to its default value
8 Ext
.define('Proxmox.form.KVComboBox', {
9 extend
: 'Ext.form.field.ComboBox',
10 alias
: 'widget.proxmoxKVComboBox',
13 comboItems
: undefined,
14 displayField
: 'value',
18 // overide framework function to implement deleteEmpty behaviour
19 getSubmitData: function() {
23 if (!me
.disabled
&& me
.submitValue
) {
24 val
= me
.getSubmitValue();
25 if (val
!== null && val
!== '' && val
!== '__default__') {
27 data
[me
.getName()] = val
;
28 } else if (me
.deleteEmpty
) {
30 data
['delete'] = me
.getName();
36 validator: function(val
) {
39 if (me
.editable
|| val
=== null || val
=== '') {
43 if (me
.store
.getCount() > 0) {
44 var values
= me
.multiSelect
? val
.split(me
.delimiter
) : [val
];
45 var items
= me
.store
.getData().collect('value', 'data');
46 if (Ext
.Array
.every(values
, function(value
) {
47 return Ext
.Array
.contains(items
, value
);
53 // returns a boolean or string
54 /*jslint confusion: true */
55 return "value '" + val
+ "' not allowed!";
58 initComponent: function() {
61 me
.store
= Ext
.create('Ext.data.ArrayStore', {
66 if (me
.initialConfig
.editable
=== undefined) {