]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - form/KVComboBox.js
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',
16 comboItems
: undefined,
17 displayField
: 'value',
21 // overide framework function to implement deleteEmpty behaviour
22 getSubmitData: function() {
26 if (!me
.disabled
&& me
.submitValue
) {
27 val
= me
.getSubmitValue();
28 if (val
!== null && val
!== '' && val
!== '__default__') {
30 data
[me
.getName()] = val
;
31 } else if (me
.getDeleteEmpty()) {
33 data
['delete'] = me
.getName();
39 validator: function(val
) {
42 if (me
.editable
|| val
=== null || val
=== '') {
46 if (me
.store
.getCount() > 0) {
47 var values
= me
.multiSelect
? val
.split(me
.delimiter
) : [val
];
48 var items
= me
.store
.getData().collect('value', 'data');
49 if (Ext
.Array
.every(values
, function(value
) {
50 return Ext
.Array
.contains(items
, value
);
56 // returns a boolean or string
57 /*jslint confusion: true */
58 return "value '" + val
+ "' not allowed!";
61 initComponent: function() {
64 me
.store
= Ext
.create('Ext.data.ArrayStore', {
69 if (me
.initialConfig
.editable
=== undefined) {