ul grouping by date in reverse order?

5 posts, 0 answers
  1. Kenneth
    Kenneth avatar
    101 posts
    Member since:
    Apr 2014

    Posted 14 Oct Link to this post

    In datasource I specify the group field - works fine with text, sorting in ASC order.

    I would like to group by date in DESC order, that is, most recent date first.

    When I group on a date field I get the error:

    Uncaught TypeError: d.myDate.getTime is not a function

    I can convert the date to text, but then it does not sort correctly when using mm/dd/yyyy.

    Even in yyyy/mm/dd format it is sorted ASC, not DESC as I require.

    Is there a solution for this?

     

    data: new kendo.data.DataSource({
            transport: {
                read: {
                    url: function () {
                        return app.uri + "clients";
                    },
                    type: "get",
                    dataType: "json"
                }
            },
            schema: {
                data: function (response) {

                     var obj = $.parseJSON(response);

                    return obj;
                }
            },
            group: { field: "Date" } //causes error
        })

     

  2. Kenneth
    Kenneth avatar
    101 posts
    Member since:
    Apr 2014

    Posted 14 Oct in reply to Kenneth Link to this post

    type in code snippet, should be:  group: { field: "myDate" } //causes error
  3. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 19 Oct Link to this post

    Hi Kenneth,

    Can you confirm that you have defined a correct model for your DataSource and that the date returned by your service can be successfully parsed by the DataSource. This Dojo shows a DataSource grouped by a date field:
    http://dojo.telerik.com/akElE
    It shows that with a correctly defined model, the data is grouped successfully.

    If the issue on your side persists, please create a Dojo to show us how your DataSource works or open a support ticket and send us your project.

    Regards,
    Tsvetina
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  4. Kenneth
    Kenneth avatar
    101 posts
    Member since:
    Apr 2014

    Posted 20 Oct in reply to Tsvetina Link to this post

    I was not setting a model for the data, that did prevent the error message. I was asking about an unordered list not the grid, but I see if I want to reverse sort I may need to use a grid instead.

    In JSON, what format should dates be in.  If I query a date from Sql Server the JSON representation looks like this:

     "Date\":\"\\/Date(1476750964337)\\/\"},

    Should it be this or something like 

    ...,\"Date\":\"Oct 17 2016  7:36PM\"},...

  5. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 21 Oct Link to this post

    Hi Kenneth,

    I was using a demo with a Grid to demonstrate the data grouping. The settings that we are discussing are directly related to the DataSource only.

    If you have difficulties with binding your list to the grouped data, please show us your list declaration and related code. It would be best if you could put up a Dojo demonstrating the issue.


    Regards,
    Tsvetina
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top