Sort date in kendo grid

1 Answer 109 Views
Sortable
Pedro
Top achievements
Rank 1
Iron
Pedro asked on 14 Feb 2023, 03:24 PM

Hello,

I'm trying sort by date my data, but is not working. I already tried a lot of approach but none work.

Expiration Date is a date

Expiration Date Format is a string, so don't give to sort.

Please help me, what is wrong? 

Strange that in another site is working this approach.

Nikolay
Telerik team
commented on 17 Feb 2023, 11:13 AM

Hi Pedro,

Thank you for sharing the code snippets.

I looked into them and noticed that you set type for the columns but such property is actually not available.

You need to set the type of the properties inside the dataSource schema.model. For example:

              dataSource: {
                    type: "odata",
                    transport: {
                        read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders"
                    },
                    schema: {
                        model: {
                            fields: {
                                OrderID: { type: "number" },
                                Freight: { type: "number" },
                                ShipName: { type: "string" },
                                OrderDate: { type: "date" },
                                ShipCity: { type: "string" }
                            }
                        }
                    },

Once the type for the date property is set to "date" the soring shall be working as expected.

Please let me know if this resolves the situation. If not I will appreciate preparing a Dojo demo where the problem is replicated so I can investigate further.

Regards,

Nikolay

1 Answer, 1 is accepted

Sort by
0
Pedro
Top achievements
Rank 1
Iron
answered on 17 Feb 2023, 12:52 PM

Hey Nikolay,

I put also this column as date, but also is not working. I believe that is some configuration of Sharepoint site that isn't create this column correctly in list.

Thank by help

Nikolay
Telerik team
commented on 22 Feb 2023, 09:43 AM

Hi Pedro,

Please let us know if you manage to resolve the situation. This will be helpful to others facing the same scenario.

If you need further assistance let us know as well.

Regards,

Nikolay

Pedro
Top achievements
Rank 1
Iron
commented on 22 Feb 2023, 12:20 PM

Of course.
Tags
Sortable
Asked by
Pedro
Top achievements
Rank 1
Iron
Answers by
Pedro
Top achievements
Rank 1
Iron
Share this question
or