File tree 4 files changed +30
-20
lines changed 4 files changed +30
-20
lines changed Original file line number Diff line number Diff line change 95
95
serviceUrl : null ,
96
96
lookup : null ,
97
97
onSelect : null ,
98
+ onHint : null ,
98
99
width : 'auto' ,
99
100
minChars : 1 ,
100
101
maxHeight : 300 ,
632
633
that . selectedIndex = - 1 ;
633
634
clearTimeout ( that . onChangeTimeout ) ;
634
635
$ ( that . suggestionsContainer ) . hide ( ) ;
635
- that . signalHint ( null ) ;
636
+ that . onHint ( null ) ;
636
637
} ,
637
638
638
639
suggest : function ( ) {
768
769
return ! foundMatch ;
769
770
} ) ;
770
771
771
- that . signalHint ( bestMatch ) ;
772
+ that . onHint ( bestMatch ) ;
772
773
} ,
773
774
774
- signalHint : function ( suggestion ) {
775
- var hintValue = '' ,
776
- that = this ;
775
+ onHint : function ( suggestion ) {
776
+ var that = this ,
777
+ onHintCallback = that . options . onHint ,
778
+ hintValue = '' ;
779
+
777
780
if ( suggestion ) {
778
781
hintValue = that . currentValue + suggestion . value . substr ( that . currentValue . length ) ;
779
782
}
780
783
if ( that . hintValue !== hintValue ) {
781
784
that . hintValue = hintValue ;
782
785
that . hint = suggestion ;
783
- ( this . options . onHint || $ . noop ) ( hintValue ) ;
784
- }
786
+ if ( $ . isFunction ( onHintCallback ) ) {
787
+ onHintCallback . call ( that . element , hintValue ) ;
788
+ }
789
+ }
785
790
} ,
786
791
787
792
verifySuggestionsFormat : function ( suggestions ) {
922
927
that . el . val ( that . getValue ( that . suggestions [ index ] . value ) ) ;
923
928
}
924
929
925
- that . signalHint ( null ) ;
930
+ that . onHint ( null ) ;
926
931
} ,
927
932
928
933
onSelect : function ( index ) {
936
941
that . el . val ( that . currentValue ) ;
937
942
}
938
943
939
- that . signalHint ( null ) ;
944
+ that . onHint ( null ) ;
940
945
that . suggestions = [ ] ;
941
946
that . selection = suggestion ;
942
947
You can’t perform that action at this time.
0 commit comments