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

Cannot get AutoComplete to Work

1 Answer 206 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 24 Feb 2017, 09:25 PM

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)

 

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 27 Feb 2017, 08:01 AM
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.
Tags
AutoComplete
Asked by
Randy
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or