@@ -94,31 +94,36 @@ Ext4.define('LDK.plugin.UserEditableCombo', {
9494 this . addValueIfNeeded ( val ) ;
9595
9696 this . callOverridden ( arguments ) ;
97- } ,
98- tpl : Ext4 . create ( 'Ext.XTemplate' ,
99- '<ul class="x4-list-plain">' ,
100- '<tpl for=".">' ,
101- '<li role="option" class="x4-boundlist-item">' ,
102- '{[this.formatLookup(values)]}' ,
103- '</li>' ,
104- '</tpl>' ,
105- '</ul>' ,
106- {
107- formatLookup : function ( value ) {
108- const val = value [ this . field . displayField ] || value [ this . field . valueField ] || '' ;
109- if ( Ext4 . isEmpty ( val ) ) {
110- return '' ;
111- }
97+ }
98+ } ) ;
11299
113- if ( this . field . userEditablePlugin . useBracketsForUnknownValues && value . invalid ) {
114- return '[' + LABKEY . Utils . encodeHtml ( val ) + ']' ;
100+ if ( this . useBracketsForUnknownValues ) {
101+ Ext4 . override ( combo , {
102+ tpl : Ext4 . create ( 'Ext.XTemplate' ,
103+ '<ul class="x4-list-plain">' ,
104+ '<tpl for=".">' ,
105+ '<li role="option" class="x4-boundlist-item">' ,
106+ '{[this.formatLookup(values)]}' ,
107+ '</li>' ,
108+ '</tpl>' ,
109+ '</ul>' ,
110+ {
111+ formatLookup : function ( value ) {
112+ const val = value [ this . field . displayField ] || value [ this . field . valueField ] || '' ;
113+ if ( Ext4 . isEmpty ( val ) ) {
114+ return '' ;
115+ }
116+
117+ if ( value . invalid ) {
118+ return '[' + LABKEY . Utils . encodeHtml ( val ) + ']' ;
119+ }
120+
121+ return LABKEY . Utils . encodeHtml ( val ) ;
115122 }
116-
117- return LABKEY . Utils . encodeHtml ( val ) ;
118123 }
119- }
120- )
121- } ) ;
124+ )
125+ } ) ;
126+ }
122127
123128 combo . store . on ( 'add' , this . onStoreAdd , this ) ;
124129 combo . store . on ( 'load' , combo . ensureValueInStore , combo ) ;
0 commit comments