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

Grid Sorting issue

2 Answers 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
cra
Top achievements
Rank 1
cra asked on 25 Jan 2016, 09:32 PM

Hello all,

 

I have a grid bound to a datasource that is receiving data from an odata-v4 endpoint. The data is loaded correctly and I have several columns with templates defined as the data has some complex values. One of the fields in this complex object is a date field (returned as so: "2015-09-01T00:00:00-05:00"). By default sorting by this column does not work, neither does formatting using the format property in the grid column (format: "{0:MM/dd/yyyy}"). So I realize I need to declare the field as a date type in the schema.model. Thus I have: 

 

 

schema: {
    model: {
        fields: {
            workPeriod: {
                startDate: {type: "date"}
            }
        }
    }
}

 

However, this does not seem to be declaring the type correctly. Is this not how you reference a complex object in the schema for a datasource?

2 Answers, 1 is accepted

Sort by
0
cra
Top achievements
Rank 1
answered on 26 Jan 2016, 02:28 PM

UPDATE:

 

It seems there is no way to reference a nested object in the model. But what I was able to do was create a reference to a nested object at the "root" object using the from: attribute like so:

 

startDate: {type: "date" , from: "workPeriod.startDate"}

 

0
Boyan Dimitrov
Telerik team
answered on 27 Jan 2016, 02:48 PM

Hello,

 

Indeed the Kendo UI DataSource is designed to work with flat data and does not support nested objects. Indeed this is the only to achieve sorting against complex object. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
cra
Top achievements
Rank 1
Answers by
cra
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or