From 6b759b74c0470164abd614e0a89bcfccbc8363b1 Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Thu, 29 Dec 2016 12:43:54 -0500 Subject: [PATCH] Search remote data before showing if necessary #4041, fix typo in remote search setting --- RELEASE-NOTES.md | 1 + src/definitions/modules/dropdown.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index efdd4ccbb..cc7bd8fc4 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -12,6 +12,7 @@ **Bugs** - **Button** - Fixed issue where css specificity caused `icon buttons` to not center correctly #4487 +- **Dropdown** - Fixed bug where clicking `dropdown icon` using remote data would cause nothing to happen #4041 - **Dropdown** - Fix bug where `scrolling menu` or `scrolling dropdown` would have excessive right padding by removing scrollbar width from calculation (no longer necessary in modern browsers) - **Comments** - `small`, `large` and other comment sizes now default to global size variables. diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 81687e33b..446a06c75 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -461,6 +461,10 @@ $.fn.dropdown = function(parameters) { ? callback : function(){} ; + if(!module.can.show() && module.is.remote()) { + module.debug('No API results retrieved, searching before show'); + module.queryRemote(module.get.query(), module.show); + } if( module.can.show() && !module.is.active() ) { module.debug('Showing dropdown'); if(module.has.message() && !(module.has.maxSelections() || module.has.allResultsFiltered()) ) { @@ -702,7 +706,7 @@ $.fn.dropdown = function(parameters) { if(settings.apiSettings) { if( module.can.useAPI() ) { module.queryRemote(searchTerm, function() { - if(settings.filterAPIResults) { + if(settings.filterRemoteData) { module.filterItems(searchTerm); } afterFiltered(); @@ -3086,6 +3090,9 @@ $.fn.dropdown = function(parameters) { multiple: function() { return $module.hasClass(className.multiple); }, + remote: function() { + return settings.apiSettings && module.can.useAPI(); + }, single: function() { return !module.is.multiple(); },