Skip to content

Commit

Permalink
Adds ability to use a different expected field group with API #3080
Browse files Browse the repository at this point in the history
  • Loading branch information
jlukic committed Nov 1, 2015
1 parent 9856d4b commit 89c3a44
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ $.fn.dropdown = function(parameters) {
onSuccess : function(response) {
module.remove.message();
module.setup.menu({
values: response.results
values: response[fields.remoteValues]
});
callback();
}
Expand Down Expand Up @@ -3332,9 +3332,10 @@ $.fn.dropdown.settings = {

// property names for remote query
fields: {
values : 'values', // grouping for all dropdown values
name : 'name', // displayed dropdown text
value : 'value' // actual dropdown value
remoteValues : 'results', // grouping for api results
values : 'values', // grouping for all dropdown values
name : 'name', // displayed dropdown text
value : 'value' // actual dropdown value
},

selector : {
Expand Down Expand Up @@ -3409,10 +3410,10 @@ $.fn.dropdown.settings.templates = {
// generates just menu from select
menu: function(response, fields) {
var
values = response.values || {},
values = response[fields.values] || {},
html = ''
;
$.each(response[fields.values], function(index, option) {
$.each(values, function(index, option) {
html += '<div class="item" data-value="' + option[fields.value] + '">' + option[fields.name] + '</div>';
});
return html;
Expand Down

0 comments on commit 89c3a44

Please sign in to comment.