Using multi column combo box as auto complete

0 Answers 101 Views
MultiColumnComboBox
Wallace
Top achievements
Rank 1
Wallace asked on 18 Sep 2024, 06:49 PM

I want to use Kendo multi column combo box as an auto-complete input. My data source is accessed via an API. The API URL can include filter parameters. All of our data sources are very large (tens of thousands of records), so I need to do server-side filtering by adjusting the parameter portion of the URL.

What properties, events and methods would I use to refresh the data source as the user is typing (with delay)?

pseudo code:

combobox.onchange() {

  ApiUrl = "https://blahblah/getRecords?filterstring=" + combobox.val();

  combobox.datasource.transport.read = ApiUrl

}

I can't seem to figure out how to get something to work. Seems like this should be easy to do.

Any suggestions would be greatly appreciated.

Neli
Telerik team
commented on 23 Sep 2024, 10:32 AM

Hi Wallace,

Could you please provide more details about the expected result as I am not sure I understand the issue correctly. 

If you need to filter the MultiColumnComboBox on the server you could take a look at the Server Filtering MultiColumnComboBox Demo:

- https://demos.telerik.com/kendo-ui/autocomplete/serverfiltering

You could also take a look at the following article regarding server filtering. Although the article is regarding ComboBox, the same is applicable for the MultiColumnComboBox component. In the article it is also described how a parameter for filtering can be sent to the remote endpoint using the data option:

- https://docs.telerik.com/kendo-ui/controls/combobox/serverfiltering

I hope you will find the provided information helpful.

Regards,

Neli

 

Wallace
Top achievements
Rank 1
commented on 23 Sep 2024, 12:01 PM

I figured it out. I don't know if this is the best way, but it seems to work well.

I added the following functions to the component initialization

ComponentInitialization.......

,filtering: function(e) {
var filter = e.filter;
// stop the filtering from actually doing anything
e.preventDefault();

// If the user has typed more than two characters, load the box with up to 500 matches
if (filter.value.length >= 2) {
let gu = ApiBaseUrl + ApiEndpoint +  "?" + "FilterString=%22" + filter.value + "%22"
$("#KeyInput").data('kendoMultiColumnComboBox').dataSource.transport.options.read.url = gu
$("#KeyInput").data('kendoMultiColumnComboBox').dataSource.read();
}
},
change: function(e) {
SelectionSubmit(this.value());
},

Neli
Telerik team
commented on 26 Sep 2024, 07:10 AM

I am glad to hear you have managed to resolve the issue yourself. Thank you very much for sharing more details on your approach as I am sure it will be helpful to the other users in the forum.

Reagrds,

Neli

No answers yet. Maybe you can help?

Tags
MultiColumnComboBox
Asked by
Wallace
Top achievements
Rank 1
Share this question
or