Browse Source

Added ability to specify dropdown label text when using API

See:
http://semantic-ui.com/modules/dropdown.html#specifying-different-text--
hidden-input-values
pull/3088/head
John Schult 9 years ago
parent
commit
81e269bd65
1 changed files with 6 additions and 1 deletions
  1. 7
      src/definitions/modules/dropdown.js

7
src/definitions/modules/dropdown.js

@ -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
},
@ -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;
},

Loading…
Cancel
Save