Cannot get AutoComplete to Work

2 posts, 0 answers
  1. Randy
    Randy avatar
    55 posts
    Member since:
    Jul 2009

    Posted 24 Feb Link to this post

    I have the following code on a page. 

        @(Html.Kendo().AutoComplete()
            .Name("categoryAutocomplete")
            .DataTextField("Combined")
            .Filter("contains")
            .MinLength(3)
            .HtmlAttributes(new { style = "width:200px" })
            .DataSource(source => source.Read(read => read.Action("GetAntiqueCategories", "Customer"))
            .ServerFiltering(false)
            )
        )

    When the page loads and I start typing into the control, the appropriate controller method is getting called and data is returned but I get a JS error in the browser saying:

    Uncaught TypeError: e.slice is not a function

        at init.success (kendo.all.min.js:27)
        at success (kendo.all.min.js:27)
        at Object.n.success (kendo.all.min.js:27)
        at i (jquery-1.12.4.min.js:2)
        at Object.fireWith [as resolveWith] (jquery-1.12.4.min.js:2)
        at y (jquery-1.12.4.min.js:4)
        at XMLHttpRequest.c (jquery-1.12.4.min.js:4)

     

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1268 posts

    Posted 27 Feb Link to this post

    Hello Randy,

    I assume this is how you are returning data from the controller:
    return Json(products, JsonRequestBehavior.AllowGet);

    Could you check whether the response data is in the expected format, for example:
    [{"ProductID":17,"ProductName":"Alice Mutton","UnitPrice":39.00,"UnitsInStock":0,"Discontinued":true,"LastSupply":"\/Date(-62135596800000)\/","UnitsOnOrder":0,"Category":null,"CategoryID":null,"QuantityPerUnit":null},{"ProductID":56,"ProductName":"Gnocchi di nonna Alice","UnitPrice":38.00,"UnitsInStock":21,"Discontinued":false,"LastSupply":"\/Date(-62135596800000)\/","UnitsOnOrder":10,"Category":null,"CategoryID":null,"QuantityPerUnit":null}]


    Regards,
    Ivan Danchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top