Skip to content
Snippets Groups Projects
Commit b3be36eb authored by Peter Rotich's avatar Peter Rotich
Browse files

Add render option - used to display more info

parent 466d8320
No related branches found
No related tags found
No related merge requests found
...@@ -82,7 +82,6 @@ ...@@ -82,7 +82,6 @@
, value , value
this.query = this.$element.val(); this.query = this.$element.val();
/*Check if we have a match on the current source?? */ /*Check if we have a match on the current source?? */
if (typeof this.source == "function") { if (typeof this.source == "function") {
value = this.source(this, this.query) value = this.source(this, this.query)
...@@ -157,8 +156,12 @@ ...@@ -157,8 +156,12 @@
items = $(items).map(function (i, item) { items = $(items).map(function (i, item) {
i = $(that.options.item).attr('data-value', JSON.stringify(item)) i = $(that.options.item).attr('data-value', JSON.stringify(item))
if (!that.strings) if (!that.strings) {
item = item[that.options.property] if(item[that.options.render])
item = item[that.options.render];
else
item = item[that.options.property];
}
i.find('a').html(that.highlighter(item)) i.find('a').html(that.highlighter(item))
return i[0] return i[0]
}) })
...@@ -294,6 +297,7 @@ ...@@ -294,6 +297,7 @@
, item: '<li><a href="#"></a></li>' , item: '<li><a href="#"></a></li>'
, onselect: null , onselect: null
, property: 'value' , property: 'value'
, render: 'info'
} }
$.fn.typeahead.Constructor = Typeahead $.fn.typeahead.Constructor = Typeahead
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment