diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index faa7424cc1..d215512210 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,6 +10,7 @@ - **Checkbox** - Added 4 new callbacks `beforeChecked`, `beforeUnchecked`, `beforeDeterminate`, `beforeIndeterminate`. You can now cancel a state change by returning false from these callbacks. - **Divider** - Vertical divider can now be used multiple times in a single column row (not just 50/50 split). #2808 - **Dropdown** - Dropdown will now automatically update selected values when hidden input value changes (so long as `change` event is triggered) #2626 +- **Dropdown** - Dropdown using remote data, can now customize the property names returned by api call using `fields` (similar to search). - **Form Validation** - Added credit card validation, supports array of card types, and international cards including non luhn cards like China UnionPay #2729 - **Form Validation** - Updated appearance of form validation prompts to use a more lightweight style. Added variables for controlling error validation prompt styles in `form.variables` - **Grid** - Added new responsive [`reversed`](http://www.semantic-ui.com/collections/grid.html#responsive-order) variations for reversing column order, these are also compatible with other grid types like `divided` and `celled` by device #2685 diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index b67971cf4f..5243460633 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -39,6 +39,7 @@ $.fn.dropdown = function(parameters) { className = settings.className, message = settings.message, + fields = settings.fields, metadata = settings.metadata, namespace = settings.namespace, regExp = settings.regExp, @@ -328,7 +329,7 @@ $.fn.dropdown = function(parameters) { module.refresh(); }, menu: function(values) { - $menu.html( templates.menu( values )); + $menu.html( templates.menu(values, fields)); $item = $menu.find(selector.item); }, reference: function() { @@ -2544,7 +2545,6 @@ $.fn.dropdown = function(parameters) { ; if(module.is.multiple()) { if(settings.useLabels) { - console.log(selectedValue); module.remove.value(selectedValue, selectedText, $selected); module.remove.label(selectedValue); } @@ -3293,6 +3293,13 @@ $.fn.dropdown.settings = { value : 'value' }, + // property names for remote query + fields: { + values : 'values', + name : 'name', + value : 'value' + }, + selector : { addition : '.addition', dropdown : '.ui.dropdown', @@ -3363,13 +3370,13 @@ $.fn.dropdown.settings.templates = { }, // generates just menu from select - menu: function(response) { + menu: function(response, fields) { var values = response.values || {}, html = '' ; - $.each(response.values, function(index, option) { - html += '