Skip to content

Commit cf7ad35

Browse files
committed
#6159 fixed the initial value rendering for ComboBox based editors
1 parent 4945571 commit cf7ad35

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/form/field/ComboBox.mjs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class ComboBox extends Picker {
165165
*/
166166
afterSetStore(value, oldValue) {
167167
let me = this,
168-
filters;
168+
filters, val;
169169

170170
if (value) {
171171
if (me.useFilter) {
@@ -185,7 +185,14 @@ class ComboBox extends Picker {
185185
me.list.store = value
186186
}
187187

188-
value.on('load', me.onStoreLoad, me)
188+
value.on('load', me.onStoreLoad, me);
189+
190+
if (me.value) {
191+
val = me.value;
192+
193+
me._value = null; // silent reset to trigger a change event
194+
me.value = val
195+
}
189196
}
190197
}
191198

@@ -248,6 +255,11 @@ class ComboBox extends Picker {
248255
let me = this,
249256
{displayField, valueField} = me;
250257

258+
// Do not create a default store instance, in case there is a bound store to be created
259+
if (!value && me.bind?.store) {
260+
return null
261+
}
262+
251263
oldValue?.destroy();
252264

253265
// Promote an array of items to be a Store
@@ -312,6 +324,10 @@ class ComboBox extends Picker {
312324
return null
313325
}
314326

327+
if (!store) { // We will (re)set the value once the store is created
328+
return value
329+
}
330+
315331
// we can only match record ids or display values in case the store is loaded
316332
if (store.getCount() > 0) {
317333
record = store.isFiltered() ? store.allItems.get(value) : store.get(value);

0 commit comments

Comments
 (0)