Invoke AutoComplete dataSource refresh

3 posts, 0 answers
  1. Paul Russo
    Paul Russo avatar
    2 posts
    Member since:
    Jun 2010

    Posted 05 Sep 2012 Link to this post

    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. Paul Russo
    Paul Russo avatar
    2 posts
    Member since:
    Jun 2010

    Posted 06 Sep 2012 Link to this post

    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. 
  3. Kendo UI is VS 2017 Ready
  4. Darcy
    Darcy avatar
    1 posts
    Member since:
    Sep 2012

    Posted 18 Sep 2012 Link to this post

    I was able to view it and it's awesome.
Back to Top