New to Kendo UI for jQuery? Download free 30-day trial

An Error that e.slice Is Not a Function Occurs

Environment

Product Progress® Kendo UI® for jQuery
Kendo Version 2017.2.621

Description 

A warning that e.slice is not a function occurs.

Cause

The error indicates that the response which is received from the remote data source is not an array while the widget expects a simple array for its data source.

Widgets like the TreeView or the MultiSelect need only a simple array while the Grid needs an envelope with additional information such as total, errors, and aggregates. For more information on what information each widget expects, review the demo of the respective control.

The possible cause for the e.slice is not a function error is that the server does not return an actual list of objects but empty data, an error response, or a single item. In such cases, you get a single object or HTML instead of a serialized array.

Error Message

Uncaught TypeError: e.slice is not a function

Solution

To solve this issue, step through the server method that returns data and monitor the response in the browser dev toolbar to see what you get and ensure it is something like [{"fieldName": 123, "otherField": "someValue"}, {"fieldName": 234, "otherField": "otherValue"}].

In this article