aboutsummaryrefslogtreecommitdiff
path: root/docs/assets/js/bootstrap-typeahead.js
diff options
context:
space:
mode:
Diffstat (limited to 'docs/assets/js/bootstrap-typeahead.js')
-rw-r--r--docs/assets/js/bootstrap-typeahead.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/docs/assets/js/bootstrap-typeahead.js b/docs/assets/js/bootstrap-typeahead.js
index e5197a331..6e896bb98 100644
--- a/docs/assets/js/bootstrap-typeahead.js
+++ b/docs/assets/js/bootstrap-typeahead.js
@@ -77,9 +77,7 @@
}
, lookup: function (event) {
- var that = this
- , items
- , q
+ var items
this.query = this.$element.val()
@@ -87,7 +85,15 @@
return this.shown ? this.hide() : this
}
- items = $.grep(this.source, function (item) {
+ items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
+
+ return items ? this.process(items) : this
+ }
+
+ , process: function (items) {
+ var that = this
+
+ items = $.grep(items, function (item) {
return that.matcher(item)
})
@@ -290,4 +296,4 @@
})
})
-}(window.jQuery); \ No newline at end of file
+}(window.jQuery);