Reputation: 5263
I want my semantic-ui search input to behave just a bit more like a dropdown, by showing ALL options when clicking the empty field.
Here's a jsfiddle that gets pretty close. It works fine (with fulltext search) after entry ...
... but a way of showing the entire list isn't indicated. I ended up trying something like ...
$('.ui.search').search({
type: 'category',
maxResults: 70,
source: categoryContent,
fullTextSearch: true,
searchFields: [
'title',
'category'
],
onSelect: function(a){
// do something
}
}).on('click', function(){
if ($(this).val()=='') {
$('.ui.search').search('show results', function(){
// this isn't right...
// how do you show ALL results when clicking empty imput?
});
}
});
But that ain't right. Any advice on showing ALL options when the input field is empty?
Upvotes: 2
Views: 1205
Reputation: 2145
You can set the minCharacters
to 0. Try this:
$('.ui.search').search({
type: 'category',
maxResults: 70,
source: categoryContent,
fullTextSearch: true,
searchFields: [
'title',
'category'
],
onSelect: function(a){
// do something
},
minCharacters: 0
});
Upvotes: 4