Open gpunktschmitz opened 8 years ago
i have also same issue. is any solution of this ?
now my data is data: ["Amazon","CarDekho","Clovia","Coke2home","Dailyobjects","Dominos","Faballey","Flipkart","Homeshop18","IndianGiftsPortal","Indiatimes","Koovs","LensKart","Limeroad","Makemytrip","Nykaa","Pepperfry","Printland","Shopcj","Shopclues","Smiledrive","Snapdeal","Stalkbuylove","Trendin","Yepme","Zovi"],
so, when i type "S" letter then only show start with s letter.
how i can do ?
thanks.
I have success by using something like this :
var self = $(this), options = {
data: self.data('autocomplete'),
autocompleteOff: false,
minCharNumber: 1,
placeholder: true,
list: {
sort: {
enabled: true,
method: function(a, b) {
return a.toLowerCase().indexOf(self.val().toLowerCase());
}
},
match: {
enabled: true
}
}
};
Can you please explain what 'this' is in your case? The input field? I'm getting weird results anyway :-(
@gpunktschmitz @amol9supe @GiacomoP If you want plugin match from the beginning of the word, use this settings for matching:
list: {
match: {
enabled: true,
method: function(element, phrase) {
if(element.indexOf(phrase) === 0) {
return true;
} else {
return false;
}
}
}
}
Thank you Łukasz! I was experimenting with the 'method' function as it seemed the way to do it.
@pawelczak Thanks. That works nicely.
Any Idea how to adapt the highlighting accordingly?
@pawelczak you should add it to documentation thats worked perfect !
hi! I've got a list of street names: Braid Ave Calton Rd Grassmarket North Bridge Potterrow South Bridge
I'd like to match only the beginning of each list item. so if someone types in "br" only "braid ave" should be displayed. and if "n" is typed in only "north bridge" should be displayed and not all list items that have "n" in them.
could you please explain how this can be done?
thanks in advance!
KR Guenther