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

odata not filling the kendo grid

1 Answer 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kenVic
Top achievements
Rank 1
kenVic asked on 10 May 2013, 09:54 PM
My code below does not populate the fields in the grid. I get an empty grid with headers only.
Fiddler shows that the read is executed and returning results. Any ideas?
$("#pageresultGrid").kendoGrid({
            dataSource: {
                type: "odata",
                schema: {
                    model: {
                        fields: {
                            DRG: { type: "string" },
                            DRGDescription: { type: "string" },
                        }
                    },

                    errors: function (response) {
                        return response.errors;
                    },
                    data: function (response) {
                        return response["value"];
                    }
                },
                transport: {
                    read: {
                        url: ksWebApiSearchUrl,
                        dataType: "jsonp"
                    }
                }
            },

            pageable: {
                numeric: true,

                refresh: true,

                pageSize: 5,

                previousNext: true,

                input: false,

                info: false,
                messages: {
                    display: "Viewing {0} - {1} of {2}",
                    empty: "No items to display",
                    page: "Page",
                    of: "of {0}",
                    itemsPerPage: "items per page",
                    first: "Go to the first page",
                    previous: "Go to the previous page",
                    next: "Go to the next page",
                    last: "Go to the last page",
                    refresh: "Refresh"
                }
            },
            sortable: true,
            columns: [
            {
                headerTemplate: '<input type="checkbox" id="checkAll">',
                template: '<input type="checkbox" value="1" id="results-select-row1"><label class="visuallyhidden" for="results-select-row1">Select Row</label>',
                width: 40
            },
            {
                field: "DRG",
                headerAttributes: {
                    "class": "ks-gridheader"
                },
                template: '<a href="javascript:GetTabDetail(#=DRG#)">#=DRG#</a>',
                width: 60,
                title: "DRG"
            },
            {
                field: "DRGDescription",
                headerAttributes: {
                    "class": "ks-gridheader"
                },
                width: 130,
                title: "DRG Description"
            }
            ]
        });

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 13 May 2013, 06:29 AM

In the DataSource configuration you've overridden the data function which might be the cause of the issue. When you instruct the DataSource with type: "odata" it applies predefined settings in order to hide the complexity of supporting OData services.

You can find runnable example here: https://github.com/telerik/kendo-examples-asp-net/tree/master/grid-odata-crud

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