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

Kendoui DataSource odata $expand not working

1 Answer 221 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 24 Jul 2013, 09:48 PM
I have a mobile listview bound to kendoui datasource pointing to an odata service. I have a $expand hint in the datasource config to expand "Patient" property of "Claim" object, but looking the url of the odata query, the kendoui datasource is not generating the $expand code in the querystring. How can I get the kendoui datasource to generate correct $expand instruction on the querystring?

    OData query string genereated: http://localhost:1839/OData.svc/Claim?$callback=jQuery20207924230222124606_1374374358450&%24inlinecount=allpages&%24format=json&%24top=10

    <script>
        $(function () {
            var app = new kendo.mobile.Application(document.body, {
                transition: 'slide'
            });

            OData.defaultHttpClient.enableJsonpCallback = true;
            
            
            var data = new kendo.data.DataSource({
                type: "odata", // specifies data protocol
                pageSize: 10,  // limits result set
                transport: {
                    read: "http://localhost:1839/OData.svc/Claim",
                    dataType: "json",
                    data: {
                        $expand: "Patient"
                    }
                },
                schema: {
                    model: {id: "Id"},
                    data: function (data) {
                        return data.d.results;
                    },
                    total: function (data) {
                        return data.d.__count;

                    }
                },
                pageSize: 10,
                serverPaging: true,
                serverFiltering: true,
                serverSorting: true
            });

            $("#lst").kendoMobileListView(
            {
                template: "<strong>${data.ClaimNumber}</strong><br/>",
                filterable: {
                    field: "ClaimNumber",
                    operator: "contains"
                },
                dataSource: data
            });
        });
    </script>

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 26 Jul 2013, 12:39 PM
Hi,

Please try with the following configuration:

read: {
    url: "http://localhost:1839/OData.svc/Claim",
    dataType: "json",
    data: {
        $expand: "Patient"
    }
}
The data should be set to the read options. Regards,
Daniel
Telerik
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
Michael
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or