Binding dropdownlist to a subarray

2 posts, 0 answers
  1. Ashish
    Ashish  avatar
    2 posts
    Member since:
    Jun 2012

    Posted 09 Jul 2012 Link to this post

    Hello, 
    hoping that this will be simple, i am trying to show all the root collections exposed by a odata service. The code looks like this

      $(document).ready(
            function () {
                $("#widgetList").kendoDropDownList({
                    dataSource:
                    {
                        type: "json",
                        transport:
                        {
                            read: "/DynamicOData/oData/?$format=json"
                        }
                    }
                })
            });

    the values returned are by the service is
    {
    "d" : {
    "EntitySets": [
    "TopSellers", "WorstSellers"
    ]
    }
    }

  2. Daniel
    Admin
    Daniel avatar
    2230 posts

    Posted 12 Jul 2012 Link to this post

    Hello Ashish,

    You should use the DataSource schema data function to get the needed data from the returned result or specify the path from which it can be retrieved e.g.

    dataSource:
    {
        type: "json",
        transport:
        {
            read: "/DynamicOData/oData/?$format=json"
        },
        schema: {     
            data: "d.EntitySets"
        }
    }
    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!
Back to Top