From aa594501bd24d51181dc3504602aa4aaefb1cb60 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Thu, 26 Jan 2012 23:16:02 -0800 Subject: [PATCH] change typeahead to data-source instead of data-data and add to docs --- docs/assets/css/bootstrap.css | 2 +- docs/javascript.html | 8 +++++++- docs/templates/pages/javascript.mustache | 8 +++++++- js/bootstrap-typeahead.js | 7 ++++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/docs/assets/css/bootstrap.css b/docs/assets/css/bootstrap.css index 68e161051b..28f49391b5 100644 --- a/docs/assets/css/bootstrap.css +++ b/docs/assets/css/bootstrap.css @@ -6,7 +6,7 @@ * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. - * Date: Thu Jan 26 22:39:03 PST 2012 + * Date: Thu Jan 26 23:15:40 PST 2012 */ article, aside, diff --git a/docs/javascript.html b/docs/javascript.html index dd65c1b8d0..894671b7e9 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -1323,7 +1323,7 @@ $('.myCarousel').carousel({

Example

Start typing in the field below to show the typeahead results.

- +

Using bootstrap-typeahead.js

@@ -1340,6 +1340,12 @@ $('.myCarousel').carousel({ + + source + array + [ ] + The data source to query against. + items number diff --git a/docs/templates/pages/javascript.mustache b/docs/templates/pages/javascript.mustache index 59b8a03d6b..6e3ba25da4 100644 --- a/docs/templates/pages/javascript.mustache +++ b/docs/templates/pages/javascript.mustache @@ -1258,7 +1258,7 @@ $('.myCarousel').carousel({

{{_i}}Example{{/i}}

{{_i}}Start typing in the field below to show the typeahead results.{{/i}}

- +

{{_i}}Using bootstrap-typeahead.js{{/i}}

@@ -1275,6 +1275,12 @@ $('.myCarousel').carousel({ + + {{_i}}source{{/i}} + {{_i}}array{{/i}} + [ ] + {{_i}}The data source to query against.{{/i}} + {{_i}}items{{/i}} {{_i}}number{{/i}} diff --git a/js/bootstrap-typeahead.js b/js/bootstrap-typeahead.js index 1205a99caf..82c3188319 100644 --- a/js/bootstrap-typeahead.js +++ b/js/bootstrap-typeahead.js @@ -25,7 +25,7 @@ this.$element = $(element) this.options = $.extend({}, $.fn.typeahead.defaults, options) this.$menu = $(this.options.menu).appendTo('body') - this.data = this.options.data + this.source = this.options.source this.shown = false this.listen() } @@ -79,7 +79,7 @@ q = this.query.toLowerCase() - items = jQuery.grep(this.data, function (item) { + items = jQuery.grep(this.source, function (item) { if (that.matcher(item, q)) return item }) @@ -229,7 +229,8 @@ } $.fn.typeahead.defaults = { - items: 8 + source: [] + , items: 8 , menu: '' , item: '
  • ' }