Filter in combobox

Is it possible for DHTMLX to have a filter based on a substring? Let’s say in my combobox I have 3 values. “Headphones”, “Horn”, “Neverland”. When I type “Ne”, I want to get the results “Headphones” and “Neverland”.

Next bit of code works, but I have to unfocus the combobox and focus on it again to see the results…

var myValues = [ "Headphones", "Horn", "Neverland"];

var myCombobox = new dhx.Combobox("myDropdown", { placeholder: "select a value"};

myCombobox.data.parse(myValues);

myCombobox.events.on('Input', function(val) {
var filteredVals = myValues.filter((str) => {
return str.value.toLowerCase().indexOf(val.toLowerCase()) >= 0
})
myCombobox.data.parse(filteredVals)
})

So what I would like is when I type “Ne” the values in the combobox change to “Headphones” and “Neverland”.

Thanks in advance!

K

You are able to use your own custom filtering function for your combo.
Here you can find a tutorial:
https://docs.dhtmlx.com/suite/combo__customization.html#customfilterforoptions
and a working example of your required behavior:
https://snippet.dhtmlx.com/791incm9

Can’t believe I missed that! Thanks