Browse Source

Adds ability to use a different expected field group with API #3080

pull/3277/head
Jack 9 years ago
parent
commit
89c3a44c4c
1 changed files with 7 additions and 6 deletions
  1. 13
      src/definitions/modules/dropdown.js

13
src/definitions/modules/dropdown.js

@ -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();
}
@ -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 : {
@ -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;

Loading…
Cancel
Save