File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -185,7 +185,8 @@ Set input
185185
186186#### Parameters
187187
188- * ` searchInput ` ** [ string] [ 76 ] ** location name or other search input
188+ * ` searchInput ` ** [ string] [ 57 ] ** location name or other search input
189+ - ` showSuggestions ` ** [ boolean] [ 61 ] ** display suggestion on setInput call (optional, default ` false ` )
189190
190191Returns ** [ MapboxGeocoder] [ 2 ] ** this
191192
Original file line number Diff line number Diff line change @@ -928,15 +928,18 @@ MapboxGeocoder.prototype = {
928928 /**
929929 * Set input
930930 * @param {string } searchInput location name or other search input
931+ * @param {boolean } [showSuggestions=false] display suggestion on setInput call
931932 * @returns {MapboxGeocoder } this
932933 */
933- setInput : function ( searchInput ) {
934+ setInput : function ( searchInput , showSuggestions = true ) {
934935 // Set input value to passed value and clear everything else.
935936 this . _inputEl . value = searchInput ;
936937 this . _typeahead . selected = null ;
937938 this . _typeahead . clear ( ) ;
938- if ( searchInput . length >= this . options . minLength ) {
939+ if ( showSuggestions && searchInput . length >= this . options . minLength ) {
939940 this . _geocode ( searchInput ) ;
941+ } else if ( ! showSuggestions ) {
942+ this . _onChange ( ) ;
940943 }
941944 return this ;
942945 } ,
You can’t perform that action at this time.
0 commit comments