From 0b5860730670739211e7854e55de32521ba5d2cb Mon Sep 17 00:00:00 2001 From: vitalets <noginsk@rambler.ru> Date: Mon, 14 Jan 2013 17:47:48 +0400 Subject: [PATCH] smart search for $input in typeahead --- src/inputs/typeahead.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/inputs/typeahead.js b/src/inputs/typeahead.js index fd029ae..6e6e8ef 100644 --- a/src/inputs/typeahead.js +++ b/src/inputs/typeahead.js @@ -49,13 +49,17 @@ $(function(){ $.extend(Constructor.prototype, { 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; + //apply typeahead this.$input.typeahead(this.options.typeahead); //attach own render method this.$input.data('typeahead').render = $.proxy(this.typeaheadRender, this.$input.data('typeahead')); - + this.renderClear(); this.setClass(); this.setAttr('placeholder');