I am using PerpetuumSoft.Knockout library to bind autocomplete to textbox in my asp mvc application as follow:
var myCustomBinding = "...";
var text = knockoutHtml.Hidden();
text.Items.Add(new KnockoutBindingStringItem("autocomplete", myCustomBinding));
The default behavior of knockout autocomplete is firing the autocomplete field immediately after the first character was typed. I want to customize this behavior to force knockout autocomplete control to fire autocomplete field after 3 characters were typed. I don't want to validate text if there are a minimum of 3 characters typed.
I search similar question but I only need to show autocomplete after the third character was typed I don't need any other custom additional behavior.
What I must bind to knockout autocomplete (in myCustomBinding variable)? How to set the minimum length of search text?
$(".buttonclass").typeahead({
source: function (query, process) {
//your source code
},
items: 10,
autoSelect: false,
minLength: 3,
hint: true, //to highlight matching item
highlight: true,
afterSelect: function (item) {
//your code
},
matcher: () => {
return true;
},
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With