Browse Source

Finishes showNoResults setting

pull/4074/head
Jack Lukic 9 years ago
parent
commit
68b007461a
2 changed files with 24 additions and 18 deletions
  1. 2
      RELEASE-NOTES.md
  2. 40
      src/definitions/modules/search.js

2
RELEASE-NOTES.md

@ -13,7 +13,7 @@
- **Dropdown** - All dropdowns, not just `selection dropdown`, will now select the first `menu item` that starts with a pressed keyboard key, for example "N" will select "New"
- **Build Tools** - Added new `autoInstall` option to allow for Semantic to be installed without user interaction. See [docs explanation](http://www.semantic-ui.com/introduction/advanced-usage.html#Auto-Install) for how to use. #3616 **Thanks @algorithme**
- **Popup** - Fixed issue where clicking element inside popup removed from DOM (like clicking a multi select label) would cause popup to close #3887
- **Search** - Search now includes a `showNoResults` setting for determining whether no results messages should be shown **NEEDS DOCS**
**Critical Bugs**
- **All UI** - Using `setting` on a setting that is an object literal, for example `error: {}` will now extend the existing object instead of replacing it.

40
src/definitions/modules/search.js

@ -793,12 +793,15 @@ $.fn.search = function(parameters) {
return false;
}
}
$results
.html(html)
;
if( module.can.show() ) {
if(html) {
$results
.html(html)
;
module.showResults();
}
else {
module.hideResults();
}
},
showResults: function() {
@ -876,7 +879,7 @@ $.fn.search = function(parameters) {
module.error(error.noTemplate, false);
}
}
else {
else if(settings.showNoResults) {
html = module.displayMessage(error.noResults, 'empty');
}
settings.onResults.call(element, response);
@ -1080,44 +1083,47 @@ $.fn.search.settings = {
verbose : false,
performance : true,
type : 'standard',
// template to use (specified in settings.templates)
type : 'standard',
minCharacters : 1,
// minimum characters required to search
minCharacters : 1,
apiSettings : false,
// API config
apiSettings : false,
source : false,
// object to search
source : false,
// fields to search
searchFields : [
'title',
'description'
],
// fields to search
displayField : '',
// field to display in standard results template
displayField : '',
searchFullText : true,
// whether to include fuzzy results in local search
searchFullText : true,
automatic : true,
// whether to add events to prompt automatically
automatic : true,
hideDelay : 0,
// delay before hiding menu after blur
hideDelay : 0,
searchDelay : 200,
// delay before searching
searchDelay : 200,
maxResults : 7,
// maximum results returned from local
maxResults : 7,
cache : true,
// whether to store lookups in local cache
cache : true,
// whether no results errors should be shown
showNoResults : true,
// transition settings
transition : 'scale',

Loading…
Cancel
Save