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

Openaccess WCF Service Data Not Displaying in Grid

1 Answer 125 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 01 Apr 2013, 08:12 PM
I have created a simple 1 table service using Openaccess Domain Model and oData Data Service. When I try to call the service using the Kendo Grid, I can see the json data (using Fiddler) being returned/parsed but it is never displayed in the grid.

When I use IE9 to run my test, i get the following error:
Error: Unable to get value of the property '__count': object is null or undefined

I don't get that error in Chrome or Firefox but the data still does not display.

I used the example at http://demos.kendoui.com/web/grid/remote-data.html and just changed the service url and data fields as needed.

My service is a oData v3 and I have included the JSONSupportBehavior attribute in my class. You can use this link http://www.thinkkentucky.com/fidatao/ftentitiesmodelservice.svc/FUNDTYPEs?$format=json to see a text file of the data returned from my service.

I would appreciate any help to understand what is causing this problem and how to fix it.

Thanks
Ben


1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 03 Apr 2013, 10:33 AM
Hello Ben,

The problem occurs because of the OData version. The dataSource supports only version two so the returned collection will not be recognized. Please check if overriding the data and total functions of the dataSource schema as in the snippet below resolves the problem:

dataSource: {
    type: "odata",
    schema: {
        data: function (data) {
            if (data.value) {
                return data.value;
            }
            delete data["odata.metadata"];
            return [data];
        },
        total: function (data) {
            return data["odata.count"];
        }
Kind regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
Ben
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or