Pending Review
Last Updated: 28 Jun 2018 23:13 by ADMIN
Milad
Created on: 28 Jun 2018 23:07
Category: DropDownList
Type: Feature Request
2
Fix "Uncaught TypeError: Cannot read property 'slice' of undefined" Error
I have created a new Telerk UI for ASP.NET Core R2 2018 SP1 Project and added a DropDownList Component into page.
When I use "Items" to add items manually everything is OK. but when I try to use DataSource to add Items using an Action remotely a console error is happened as "Uncaught TypeError: Cannot read property 'slice' of undefined".
JSON items is received and nothing is shown because of that error.
Please HELP
3 comments
Milad
Posted on: 28 Jun 2018 23:12
[HttpPost]
        public IActionResult Read()
        {
            var list = new[]
            {
                new TestModel
                {
                    Text = "Text1",
                    Value = 1
                },
                new TestModel
                {
                    Text = "Text2",
                    Value = 2
                }
            };
            return Json(list);
        }
Milad
Posted on: 28 Jun 2018 23:11
@(Html.Kendo().DropDownList().Name("DropDownElement")
      .DataTextField("Text")
      .DataValueField("Value")
      .DataSource(ds =>
  {
      ds.Ajax().Read(r =>
      {
          r.Action("Read", "Home");
          r.Type(HttpVerbs.Post);
      });
  }))
Milad
Posted on: 28 Jun 2018 23:09
kendo.all.js:7052 Uncaught TypeError: Cannot read property 'slice' of undefined
    at init.success (kendo.all.js:7052)
    at success (kendo.all.js:6979)
    at Object.i.success (kendo.all.js:5911)
    at i (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at y (jquery.min.js:4)
    at XMLHttpRequest.c (jquery.min.js:4)
success	@	kendo.all.js:7052
success	@	kendo.all.js:6979
i.success	@	kendo.all.js:5911
i	@	jquery.min.js:2
fireWith	@	jquery.min.js:2
y	@	jquery.min.js:4
c	@	jquery.min.js:4
XMLHttpRequest.send (async)		
send	@	jquery.min.js:4
ajax	@	jquery.min.js:4
read	@	kendo.all.js:5914
read	@	kendo.aspnetmvc.js:250
(anonymous)	@	kendo.all.js:6975
_queueRequest	@	kendo.all.js:7190
read	@	kendo.all.js:6968
query	@	kendo.all.js:7391
_query	@	kendo.all.js:7422
fetch	@	kendo.all.js:7418
init	@	kendo.all.js:35456
(anonymous)	@	kendo.all.js:2441
each	@	jquery.min.js:2
each	@	jquery.min.js:2
e.fn.(anonymous function)	@	kendo.all.js:2440
(anonymous)	@	(index):24
i	@	jquery.min.js:2
fireWith	@	jquery.min.js:2
ready	@	jquery.min.js:2
K	@	jquery.min.js:2