tonyg
tonyg

Reputation: 53

Kendo UI Multiselect

I've been using the new Kendo UI Multiselect widget with server-side filtering, but I'm having trouble getting it to only make the ajax call after a minimum number of characters have been entered. I've set the autoBind and minLength options to false and 3 respectively. However it sends an ajax request to get the select options as soon as I put my cursor into the text field. It does wait until 3 characters (or more) are entered before sending another ajax request and refreshing the options list. But how do I make it wait until 3 characters have been entered before the first ajax request is sent? Here is how I've configured the the multiSelect:

  $('#delegates').kendoMultiSelect(
        {
            autoBind: false,
            minLength: 3,
            placeholder: 'Select delegates...',
            dataTextField: 'name',
            dataValueField: 'personid',
            filter: 'contains',
            delay: 200,
            dataSource: {
                serverFiltering: true,
                transport: {
                    read: {
                        url: '/my/remote/url',
                        dataType: 'json'
                    }
                }
            }
        }
    );

I've looked at the overview and API docs for the MultiSelect widgets on the KendoUI site and it doesn't even appear that there's a way to do what I'm talking about (I initially thought the autoBind: false and minLength: 3 would be my answer, but turns out it's not). So I"m posting in the hopes that maybe I've missed something. Thanks in advance.

Upvotes: 5

Views: 8951

Answers (2)

Somwang Souksavatd
Somwang Souksavatd

Reputation: 5085

$("#products").kendoMultiSelect({
                        placeholder: "Select products...",
                        dataTextField: "name",
                        dataValueField: "id",
                        autoBind: false,
                        dataSource: {
                            transport:{
                                read:{
                                    url:'products/api/get',
                                    serverPaging:true,
                                    pageSize:20,
                                    contentType:'application/json; charset=utf-8',
                                    type:'GET',
                                    dataType:'json'
                                }
                            }
                        }
                    });

Upvotes: 1

Shion
Shion

Reputation: 1499

I would go with the workaround.

If I inspect the KendoUI demos here: Server Filtering Demo with FireBug, an initial call is made as soon as the page has loaded. I think that is by design, and is as expected in the current version of the widget.

Since this is a new widget, try contacting the Kendo-Team. With a bit of luck, in the next release (or some beta in between) there will be an option for this.

Upvotes: 0

Related Questions