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

Create new datasource

3 Answers 121 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 23 Dec 2015, 03:18 PM

I am trying to create a new Kendo DataSource, but my data does not contain anything even though my result.data is an array of 14 items.

01.shipmentService.getBasicChartData(request)
02.   .then(function (result) {
03.      var dataSource = new kendo.data.DataSource({
04.          data: result.data,
05.          sort: {
06.              field: "date",
07.              dir: "asc"
08.          },
09.          schema: {
10.              model: {
11.                  fields: {
12.                      date: {
13.                          type: "date"
14.                      }
15.                  }
16.              }
17.          }
18.   });

Why is my data not being assigned? My sort item seems correct.

3 Answers, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 23 Dec 2015, 09:22 PM
Hello James,

Take a look at this dojo illustrating how to use sort in a Kendo DataSource.  In the console, you will see the data sorted correctly.  For more information pertaining to sort, here is our documentation.  I would also make sure the data you are passing is not null.

Hopefully, this steers you in the right direction.

Regards,
Patrick
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
James
Top achievements
Rank 1
answered on 23 Dec 2015, 09:24 PM
Thanks for the reply but the problem is that my _data is never populated.  It has a length of 0.  I was just saying the sort object was populated with what seemed like the correct data but the _data is not.
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 23 Dec 2015, 09:33 PM
Hi James,

The next step I would recommend is for you to create a dojo or update the one I sent you illustrating the behavior you are describing and replying with the results in this post. This is so we can isolate the issue and find a solution.

Regards,
Patrick
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Data Source
Asked by
James
Top achievements
Rank 1
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
James
Top achievements
Rank 1
Share this question
or