smart search for $input in typeahead
This commit is contained in:
@ -49,13 +49,17 @@ $(function(){
|
|||||||
|
|
||||||
$.extend(Constructor.prototype, {
|
$.extend(Constructor.prototype, {
|
||||||
renderList: function() {
|
renderList: function() {
|
||||||
|
this.$input = this.$tpl.is('input') ? this.$tpl : this.$tpl.find('input[type="text"]');
|
||||||
|
|
||||||
|
//set source of typeahead
|
||||||
this.options.typeahead.source = this.sourceData;
|
this.options.typeahead.source = this.sourceData;
|
||||||
|
|
||||||
|
//apply typeahead
|
||||||
this.$input.typeahead(this.options.typeahead);
|
this.$input.typeahead(this.options.typeahead);
|
||||||
|
|
||||||
//attach own render method
|
//attach own render method
|
||||||
this.$input.data('typeahead').render = $.proxy(this.typeaheadRender, this.$input.data('typeahead'));
|
this.$input.data('typeahead').render = $.proxy(this.typeaheadRender, this.$input.data('typeahead'));
|
||||||
|
|
||||||
this.renderClear();
|
this.renderClear();
|
||||||
this.setClass();
|
this.setClass();
|
||||||
this.setAttr('placeholder');
|
this.setAttr('placeholder');
|
||||||
|
Reference in New Issue
Block a user