Skip to content

Commit

Permalink
Issue biggora#49
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim Vohmjanin committed Nov 9, 2016
1 parent f96c55c commit 7dc350a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
13 changes: 8 additions & 5 deletions js/bootstrap-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright 2012-2016 Twitter Inc.
* Licensed under MIT (https://github.com/biggora/bootstrap-ajax-typeahead/blob/master/LICENSE)
* See Demo: http://plugins.upbootstrap.com/bootstrap-ajax-typeahead
* Updated: 2016-08-02 03:16:15
* Updated: 2016-11-09 04:40:04
*
* Modifications by Paul Warelis and Alexey Gordeyev
*/
Expand Down Expand Up @@ -37,6 +37,7 @@
that.render = that.options.render || that.render;
that.onSelect = that.options.onSelect || null;
that.sorter = that.options.sorter || that.sorter;
that.select = that.options.select || that.select;
that.source = that.options.source || that.source;
that.displayField = that.options.displayField || that.displayField;
that.valueField = that.options.valueField || that.valueField;
Expand Down Expand Up @@ -95,15 +96,16 @@
var value = $selectedItem.attr('data-value');
var text = this.$menu.find('.active a').text();

this.$element
.val(this.updater(text))
.change();

if (this.options.onSelect) {
this.options.onSelect({
value: value,
text: text
});
}
this.$element
.val(this.updater(text))
.change();
}
return this.hide();
},
Expand Down Expand Up @@ -179,7 +181,8 @@
data: params,
success: $.proxy(this.ajaxSource, this),
type: this.ajax.method || 'get',
dataType: 'json'
dataType: 'json',
headers: this.ajax.headers || {}
});
this.ajax.timerId = null;
}
Expand Down
4 changes: 2 additions & 2 deletions js/bootstrap-typeahead.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions src/bootstrap-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
that.render = that.options.render || that.render;
that.onSelect = that.options.onSelect || null;
that.sorter = that.options.sorter || that.sorter;
that.select = that.options.select || that.select;
that.source = that.options.source || that.source;
that.displayField = that.options.displayField || that.displayField;
that.valueField = that.options.valueField || that.valueField;
Expand Down Expand Up @@ -86,15 +87,16 @@
var value = $selectedItem.attr('data-value');
var text = this.$menu.find('.active a').text();

this.$element
.val(this.updater(text))
.change();

if (this.options.onSelect) {
this.options.onSelect({
value: value,
text: text
});
}
this.$element
.val(this.updater(text))
.change();
}
return this.hide();
},
Expand Down

0 comments on commit 7dc350a

Please sign in to comment.