From b3be36eb90425c8074c8a2257c8b41ce5c445d77 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Thu, 29 Mar 2012 22:19:21 -0400 Subject: [PATCH] Add render option - used to display more info --- scp/js/bootstrap-typeahead.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scp/js/bootstrap-typeahead.js b/scp/js/bootstrap-typeahead.js index dd3ca6dd8..1e039f02a 100644 --- a/scp/js/bootstrap-typeahead.js +++ b/scp/js/bootstrap-typeahead.js @@ -82,7 +82,6 @@ , value this.query = this.$element.val(); - /*Check if we have a match on the current source?? */ if (typeof this.source == "function") { value = this.source(this, this.query) @@ -157,8 +156,12 @@ items = $(items).map(function (i, item) { i = $(that.options.item).attr('data-value', JSON.stringify(item)) - if (!that.strings) - item = item[that.options.property] + if (!that.strings) { + if(item[that.options.render]) + item = item[that.options.render]; + else + item = item[that.options.property]; + } i.find('a').html(that.highlighter(item)) return i[0] }) @@ -294,6 +297,7 @@ , item: '<li><a href="#"></a></li>' , onselect: null , property: 'value' + , render: 'info' } $.fn.typeahead.Constructor = Typeahead -- GitLab