diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 247d7f789..b861b33cd 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -216,9 +216,8 @@ $.fn.dropdown = function(parameters) { api: function() { var apiSettings = { - debug : settings.debug, - cache : 'local', - on : false + debug : settings.debug, + on : false } ; module.verbose('First request, initializing API'); @@ -562,8 +561,10 @@ $.fn.dropdown = function(parameters) { queryRemote: function(query, callback) { var apiSettings = { - errorDuration : false, - urlData: { + errorDuration : false, + throttle : settings.throttle, + cache : 'local', + urlData : { query: query }, onError: function() { @@ -589,7 +590,6 @@ $.fn.dropdown = function(parameters) { apiSettings = $.extend(true, {}, apiSettings, settings.apiSettings); $module .api('setting', apiSettings) - .api('abort') .api('query') ; }, @@ -896,6 +896,9 @@ $.fn.dropdown = function(parameters) { isBubbledEvent = ($subMenu.find($target).length > 0) ; if(!isBubbledEvent && (!hasSubMenu || settings.allowCategorySelection)) { + if(!settings.useLabels) { + module.remove.searchTerm(); + } module.determine.selectAction.call(this, text, value); } } @@ -1049,6 +1052,7 @@ $.fn.dropdown = function(parameters) { // enter (select or open sub-menu) if(pressedKey == keys.enter || pressedKey == keys.delimiter) { + if(pressedKey == keys.enter && hasSelectedItem && hasSubMenu && !settings.allowCategorySelection) { module.verbose('Pressed enter on unselectable category, opening sub menu'); pressedKey = keys.rightArrow; @@ -1391,6 +1395,7 @@ $.fn.dropdown = function(parameters) { var name = module.read.remoteData(value) ; + module.verbose('Restoring value from session data', name, value); remoteValues[value] = (name) ? name : value @@ -1635,7 +1640,6 @@ $.fn.dropdown = function(parameters) { } }, values: function() { - module.debug('Restoring selected values'); module.set.initialLoad(); if(settings.apiSettings) { if(settings.saveRemoteData) { @@ -2874,7 +2878,8 @@ $.fn.dropdown.settings = { action : 'activate', // action on item selection (nothing, activate, select, combo, hide, function(){}) apiSettings : false, - saveRemoteData : false, // Whether remote name/value pairs should be stored in sessionStorage to allow remote data to be restored on page refresh + saveRemoteData : true, // Whether remote name/value pairs should be stored in sessionStorage to allow remote data to be restored on page refresh + throttle : 100, // How long to wait after last user input to search remotely direction : 'auto', // Whether dropdown should always open in one direction keepOnScreen : true, // Whether dropdown should check whether it is on screen before showing