Create new datasource

4 posts, 0 answers
  1. James
    James avatar
    37 posts
    Member since:
    Sep 2014

    Posted 23 Dec 2015 Link to this post

    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.
  2. Patrick
    Admin
    Patrick avatar
    173 posts

    Posted 23 Dec 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. James
    James avatar
    37 posts
    Member since:
    Sep 2014

    Posted 23 Dec 2015 in reply to Patrick Link to this post

    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.
  5. Patrick
    Admin
    Patrick avatar
    173 posts

    Posted 23 Dec 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready