@@ -41,25 +41,29 @@ export class IgComboComponent extends IgControlBase<IgCombo> implements ControlV
4141 super . ngOnInit ( ) ;
4242
4343 if ( this . _model ) {
44- jQuery ( this . _el ) . on ( "input" , function ( evt ) {
45- that . _model . viewToModelUpdate ( evt . target . value ) ;
46- } ) ;
47-
48- jQuery ( this . _el ) . closest ( ".ui-igcombo-wrapper" ) . find ( ".ui-igcombo-clear" ) . on ( "click" , function ( ) {
49- if ( that . options . multiSelection && that . options . multiSelection . enabled ) {
50- that . _model . viewToModelUpdate ( [ ] ) ;
51- } else {
52- that . _model . viewToModelUpdate ( null ) ;
53- }
54- } ) ;
44+ if ( this . options . allowCustomValue ) {
45+ jQuery ( this . _el ) . on ( "input" , function ( evt ) {
46+ that . _model . viewToModelUpdate ( evt . target . value ) ;
47+ } ) ;
48+
49+ jQuery ( this . _el ) . closest ( ".ui-igcombo-wrapper" ) . find ( ".ui-igcombo-clear" ) . on ( "click" , function ( ) {
50+ if ( that . options . multiSelection && that . options . multiSelection . enabled ) {
51+ that . _model . viewToModelUpdate ( [ ] ) ;
52+ } else {
53+ that . _model . viewToModelUpdate ( null ) ;
54+ }
55+ } ) ;
56+ }
5557
5658 // D.P. #244 only attach selectionchanged handler if there's a model to update
5759 jQuery ( this . _el ) . on ( this . _widgetName . toLowerCase ( ) + "selectionchanged" , function ( evt , ui ) {
5860 var items = ui . items ;
5961 const valueKey = ui . owner . options . valueKey ;
6062
6163 if ( items . length <= 0 && ! ui . owner . options . multiSelection . enabled ) {
62- that . _model . viewToModelUpdate ( null ) ;
64+ if ( ! ui . owner . options . allowCustomValue ) {
65+ that . _model . viewToModelUpdate ( null ) ;
66+ }
6367 return ;
6468 }
6569
0 commit comments