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

ul grouping by date in reverse order?

4 Answers 42 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kenneth
Top achievements
Rank 2
Iron
Kenneth asked on 14 Oct 2016, 07:00 PM

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
    })

 

4 Answers, 1 is accepted

Sort by
0
Kenneth
Top achievements
Rank 2
Iron
answered on 14 Oct 2016, 07:02 PM
type in code snippet, should be:  group: { field: "myDate" } //causes error
0
Tsvetina
Telerik team
answered on 19 Oct 2016, 10:17 AM
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
0
Kenneth
Top achievements
Rank 2
Iron
answered on 20 Oct 2016, 02:13 PM

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\"},...

0
Tsvetina
Telerik team
answered on 21 Oct 2016, 09:47 AM
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
Tags
General Discussions
Asked by
Kenneth
Top achievements
Rank 2
Iron
Answers by
Kenneth
Top achievements
Rank 2
Iron
Tsvetina
Telerik team
Share this question
or