-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntityComboBox.js
More file actions
41 lines (35 loc) · 1.29 KB
/
EntityComboBox.js
File metadata and controls
41 lines (35 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
if (!Carlsirce.component)
Ext.namespace('Carlsirce.component');
Carlsirce.component.EntityComboBox = function (params) {
this.selectEntityId = params.entityId;
params.valueFiled = 'id';
params.triggerAction = 'all';
params.forceSelection = true;
params.store.comboBox = this;
Carlsirce.component.EntityComboBox.superclass.constructor.call(this, params);
params.store.on('load', function (store, records) {
if (records.length == 0)
store.comboBox.disable();
});
}
Ext.extend(Carlsirce.component.EntityComboBox, Ext.form.ComboBox, {
onSelect: function (record) {
this.selectEntityId = record.get('id');
Carlsirce.component.EntityComboBox.superclass.onSelect.call(this, record);
},
getValue: function () {
return Carlsirce.component.EntityComboBox.superclass.getValue.call(this) != '' ? this.selectEntityId : undefined;
},
getText: function () {
return Carlsirce.component.EntityComboBox.superclass.getValue.call(this)
},
getEntity: function () {
var selectId = this.getValue();
if (selectId == undefined)
return undefined;
return this.store.getById(selectId);
},
setSelectEntityId: function (value) {
this.selectEntityId = value;
}
});