Skip to content

Commit

Permalink
Added ability to specify dropdown label text when using API
Browse files Browse the repository at this point in the history
  • Loading branch information
John Schult committed Sep 24, 2015
1 parent 8c2ed75 commit 81e269b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/definitions/modules/dropdown.js
Expand Up @@ -3312,6 +3312,7 @@ $.fn.dropdown.settings = {
fields: {
values : 'values', // grouping for all dropdown values
name : 'name', // displayed dropdown text
text : 'text', // displayed label text
value : 'value' // actual dropdown value
},

Expand Down Expand Up @@ -3388,7 +3389,11 @@ $.fn.dropdown.settings.templates = {
menu: function(response, fields) {
var html = '';
$.each(response[fields.values], function(index, option) {
html += '<div class="item" data-value="' + option[fields.value] + '">' + option[fields.name] + '</div>';
html += '<div class="item" data-value="' + option[fields.value] + '"';
if (option[fields.text]) {
html += ' data-text="' + option[fields.text] + '"';
}
html += '>' + option[fields.name] + '</div>';
});
return html;
},
Expand Down

0 comments on commit 81e269b

Please sign in to comment.