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

Kendo Grid Odata JsonLight

2 Answers 17 Views
Grid
This is a migrated thread and some comments may be shown as answers.
arif
Top achievements
Rank 1
arif asked on 12 Feb 2014, 02:08 AM
Why is not working/ data not showing in drop down list ? //Sample Ref : http://demos.telerik.com/kendo-ui/web/grid/virtualization-remote-data.html

$("#dropDownList").kendoDropDownList({
autoBind: false,
dataTextField: "Name",
dataValueField: "UserGroupId",
dataSource: {
type: "odata",
transport: {
read: "/odata/UserGroup?$select=UserGroupId,Name",
dataType: "json",
},
schema: {
data: function (data) {
return data.value;
},
total: function (data) {
return data["odata.count"];
}
},
model: {
id: "UserGroupId",
fields: {
UserGroupId: { type: "string", editable: false },
Name: { type: "string", editable: false },
}
}
}
});

Odata Result :
{
"odata.metadata":"http://localhost:47959/odata/$metadata#Roles","value":[
{
"Id":"07b8e680-ab36-4825-b709-0d2dbd90a7f2","Area":"1","Controller":"2","Action":"3","Title":"Administrator","Name":"123","Description":"Administrator","Bookmark":true
},{
"Id":"500093a6-79d8-45e0-9c68-8407269824c1","Area":"2","Controller":"2","Action":"2","Title":"2","Name":"222","Description":"2","Bookmark":false
},{

thank you.





2 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 14 Feb 2014, 06:54 AM
Hello Arif,

What you shared as code looks correct, are there are JavaScript errors in the console when running the page? If there are not, can you give us live URL which we can visit so we can investigate further? Or if possible create a JsBin example which we can use.

Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
arif
Top achievements
Rank 1
answered on 18 Feb 2014, 02:28 AM
I fixed it,

Missing "charset"

  transport: {
                        read: {
                            url: "/odata/UserGroup",//?$select=UserGroupId,Name",
                            contentType: "application/json; charset=utf-8",
                            type: "GET",
                            dataType: "json"
                        }
                    }

Thank you,
Tags
Grid
Asked by
arif
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
arif
Top achievements
Rank 1
Share this question
or