Skip to content

Commit d46c6a2

Browse files
author
root
committed
Merge discvr-22.7 to develop
2 parents b1333ae + 3289ded commit d46c6a2

File tree

2 files changed

+49
-9
lines changed

2 files changed

+49
-9
lines changed

LDK/resources/web/LDK/field/SimpleCombo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Ext4.define('LDK.form.field.SimpleCombo', {
4040
parseStoreValues: function(){
4141
this.storeValues = this.storeValues || [];
4242
if (Ext4.isString(this.storeValues)){
43-
this.storeValues = this.storeValues.split(';');
43+
this.storeValues = this.storeValues.split(this.delimiter);
4444
}
4545

4646
var vals = [];

LDK/resources/web/LDK/field/SimpleLabKeyCombo.js

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
Ext4.define('LDK.form.field.SimpleLabKeyCombo', {
99
extend: 'LABKEY.ext4.ComboBox',
1010
alias: 'widget.ldk-simplelabkeycombo',
11+
joinReturnValue: false,
12+
delimiter: ';',
13+
forceSelection: true,
14+
typeAhead: true,
15+
queryMode: 'local',
16+
triggerAction: 'all',
1117

1218
initComponent: function(){
1319
Ext4.apply(this, {
14-
forceSelection: true,
15-
typeAhead: true,
16-
queryMode: 'local',
17-
triggerAction: 'all',
1820
store: {
1921
type: 'labkey-store',
2022
containerPath: this.containerPath,
@@ -27,6 +29,14 @@ Ext4.define('LDK.form.field.SimpleLabKeyCombo', {
2729
});
2830

2931
this.callParent(arguments);
32+
33+
if (this.initialValues) {
34+
if (!Ext4.isArray(this.initialValues)) {
35+
this.initialValues = this.initialValues.split(';');
36+
}
37+
38+
this.setValue(this.initialValues);
39+
}
3040
},
3141

3242
setValue: function(val){
@@ -39,18 +49,48 @@ Ext4.define('LDK.form.field.SimpleLabKeyCombo', {
3949

4050
this.setValue.apply(this, args);
4151
}, this, {defer: 100, single: true});
52+
53+
// wait for store load:
54+
return;
55+
}
56+
57+
if (this.multiSelect && val && Ext4.isString(val)) {
58+
val = val.split(this.delimiter);
4259
}
4360

44-
if (this.store && this.valueField && Ext4.isPrimitive(val)){
61+
if (this.store && this.valueField){
4562
var field = this.store.getFields().get(this.valueField);
4663
if (field){
47-
val = field.convert(val);
48-
if (Ext4.isDefined(val)) {
49-
arguments[0] = val;
64+
if (Ext4.isPrimitive(val)) {
65+
val = field.convert(val);
66+
if (Ext4.isDefined(val)) {
67+
arguments[0] = val;
68+
}
69+
}
70+
else if (Ext4.isArray(val)) {
71+
Ext4.Array.forEach(val, function(v, idx){
72+
v = field.convert(v);
73+
if (Ext4.isDefined(v)) {
74+
val[idx] = v;
75+
}
76+
}, this);
5077
}
5178
}
5279
}
5380

5481
this.callParent(arguments);
82+
},
83+
84+
getSubmitValue: function(){
85+
var val = this.callParent(arguments);
86+
if (!Ext4.isArray(val) || !this.joinReturnValue) {
87+
return val;
88+
}
89+
90+
return val && val.length ? val.join(this.delimiter) : null;
91+
},
92+
93+
getToolParameterValue : function(){
94+
return this.getSubmitValue();
5595
}
5696
});

0 commit comments

Comments
 (0)