]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - src/form/RealmComboBox.js
1 Ext
.define('Proxmox.form.RealmComboBox', {
2 extend
: 'Ext.form.field.ComboBox',
3 alias
: 'widget.pmxRealmComboBox',
6 xclass
: 'Ext.app.ViewController',
9 let store
= view
.getStore();
10 if (view
.storeFilter
) {
11 store
.setFilters(view
.storeFilter
);
13 store
.on('load', this.onLoad
, view
);
17 onLoad: function(store
, records
, success
) {
22 let val
= me
.getValue();
23 if (!val
|| !me
.store
.findRecord('realm', val
, 0, false, true, true)) {
25 Ext
.each(records
, function(rec
) {
26 if (rec
.data
&& rec
.data
.default) {
35 // define custom filters for the underlying store
36 storeFilter
: undefined,
38 fieldLabel
: gettext('Realm'),
47 displayField
: 'descr',
48 getState: function() {
49 return { value
: this.getValue() };
51 applyState: function(state
) {
52 if (state
&& state
.value
) {
53 this.setValue(state
.value
);
56 stateEvents
: ['select'],
57 stateful
: true, // last chosen auth realm is saved between page reloads
58 id
: 'pveloginrealm', // We need stable ids when using stateful, not autogenerated
59 stateID
: 'pveloginrealm',