This is a migrated thread and some comments may be shown as answers.

Invoke AutoComplete dataSource refresh

2 Answers 183 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Paul Russo
Top achievements
Rank 1
Paul Russo asked on 05 Sep 2012, 09:49 PM
I'm using Kendo UI AutoComplete linked up to a Web Method.  It works great. 
What I am trying to do now is to have a link on the page and when clicked it will populate the autocomplete input value and then refresh the datasource based on that value.  

I can easily populate the autocomplete value with $("#search_input").data("kendoAutoComplete").value(name);  However, the data does not refresh when I do this, it still has the resultset from the previous search. How can an invoke the AutoComplete to behave as if I typed in the new value, so that the datasource result set refreshes based on the new input value?

   $("#search_input").kendoAutoComplete({
            minLength: 1,
            dataSource:
            {
                serverFiltering: true,
                serverPaging: true,
                pageSize: 20,
                transport:
                {
                    read:
                    {
                        url: "Default.aspx/GetSearchAutoComplete",
                        data: function () {
                            return { Param: $("#search_input").data("kendoAutoComplete").value() };
                        },
                        contentType: 'application/json; charset=utf-8',
                        type: 'POST',
                        dataType: 'json'
                    },
                    parameterMap: function (options) {
                        return kendo.stringify(options);
                    }
                },
                schema:
                {
                    data: function (data) {
                        searchData = data.d
                        return data.d;
                    }
                }
            },
            dataTextField: "Name",
            dataValueField: "Id"
            select: function (e) {
                searchSelectedIndex = e.item.index();
                SearchSelect();
            }
        });

2 Answers, 1 is accepted

Sort by
0
Paul Russo
Top achievements
Rank 1
answered on 06 Sep 2012, 02:07 PM
I was able to resolve the issue by coding separate call to the same WebMethod.  This in turn upates the same result set from that the autocomplete populates.  Turns out it wasn't such a big deal and probably the better way to do it. 
0
Darcy
Top achievements
Rank 1
answered on 18 Sep 2012, 11:44 AM
I was able to view it and it's awesome.
Tags
AutoComplete
Asked by
Paul Russo
Top achievements
Rank 1
Answers by
Paul Russo
Top achievements
Rank 1
Darcy
Top achievements
Rank 1
Share this question
or