How to limit number of results?
Hurtak opened this issue · 6 comments
Hurtak commented
If i have larger number of suggestions, how do i limit how much of suggestions are displayed in rendered box?
bevacqua commented
By filtering out and cutting after x results.
Hurtak commented
Hi, i am having some trouble implementing it, could you maybe provide code snippet? Thanks.
bevacqua commented
function horsefy (el) {
var i = 0, max = 50;
return horsey(el, {
filter: function () {
return i++ < max;
}
});
}
Hurtak commented
This overwrites default filtering which uses fuzzysearch with my own function which just displays first x results. How do i just filter first x results without overwriting default filtering function? Also your function doesn't reset i
to 0
so it only works first time i type.
bevacqua commented
It was just an example. You can deduce how to do the rest yourself, or submit a PR that does it in core
bevacqua commented
You can now use the limit
option