Skip to content

Commit 78fe331

Browse files
committed
Add tpl to bracket invalid lookups
1 parent e31c108 commit 78fe331

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

LDK/resources/web/LDK/plugin/UserEditableCombo.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Ext4.define('LDK.plugin.UserEditableCombo', {
8484
var rec = this.store.createModel({});
8585
rec.set(this.valueField, val);
8686
rec.set(this.displayField, val);
87+
rec.set("invalid", true);
8788

8889
this.store.add(rec);
8990
},
@@ -92,7 +93,30 @@ Ext4.define('LDK.plugin.UserEditableCombo', {
9293
this.addValueIfNeeded(val);
9394

9495
this.callOverridden(arguments);
95-
}
96+
},
97+
tpl: Ext4.create('Ext.XTemplate',
98+
'<ul class="x4-list-plain">',
99+
'<tpl for=".">',
100+
'<li role="option" class="x4-boundlist-item">',
101+
'{[this.formatLookup(values)]}',
102+
'</li>',
103+
'</tpl>',
104+
'</ul>',
105+
{
106+
formatLookup: function(value) {
107+
const val = value[this.field.displayField] || value[this.field.valueField] || '';
108+
if (Ext4.isEmpty(val)) {
109+
return '';
110+
}
111+
112+
if (value.invalid) {
113+
return '[' + LABKEY.Utils.encodeHtml(val) + ']';
114+
}
115+
116+
return LABKEY.Utils.encodeHtml(val);
117+
}
118+
}
119+
)
96120
});
97121

98122
combo.store.on('add', this.onStoreAdd, this);

0 commit comments

Comments
 (0)