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

[Solved] KendoGrid + WCF (DataServices) + Odata/Json requests

3 Answers 173 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 12 Mar 2015, 05:56 AM
Hi,

I'm trying to link a KendoGrid to a WCF service using DataServices & Odata. My requests past JSON but the request formats are ODATA format (i.e. update: myservce.svc/TimeLog(1))

For some reason thought I have been unable to get the KendoGrid to work with the service, I can load data no problem but the Create & Updates don't work, markup below for KendoGrid DataSource:

  $("#grid").kendoGrid({
dataSource: {
transport: {
read: {
url: http://localhost/myservice.svc/TimeLog_View,
//type: "GET",
dataType: "json"
},
update: {
                                                       url: function (data) {
return "http://localhost/myservice.svc/TimeLog" + "(" + data.Id + ")";
},
contentType: "application/json; charset=utf-8",
dataType: "json",
//type: "POST"


},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
schema: {
data: function (data) {
return data.value;
},
total: function (data) {
return data['odata.count'];

},
model: {
id: "Id",
fields: {
Id: { type: "number", editable: false, nullable: true },
SOW_Id: { type: "number", editable: false },
Type_Id: { type: "number", defaultValue: 1, validation: { min: 1, required: true } },
//Type_Name: { type: "text", editable: false },
Description: { type: "text" },
EstimatedHours: { type: "number" },
Rate: { type: "number", defaultValue: 225 },
Cost: { type: "number", editable: false },
LoggedHours: { type: "number", editable: false },
AdjustmentHours: { type: "number", editable: false },
CompletedHours: { type: "number", editable: false },
RemainingHours: { type: "number", editable: false },
CreationDate: { type: "date", editable: false },
CreationUser: { type: "text" },
ModifiedDate: { type: "date" },
ModifiedUser: { type: "text" }
}
}
},
//batch: true,
pageSize: 15,
serverPaging: true,
serverFiltering: true,
serverSorting: true


Can anyone point me in the right direction for what I need to do? I have searched the forms and examples but none that I've found solve the problem I'm having

Thanks,

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 16 Mar 2015, 08:11 AM
Hello Chris,

We cannot say what exactly goes based on the information that you shared. What did the server responded to your create / update operations? I assume there are some exceptions that describe the reason for the failure. Could you please check for any similar issues or JavaScript exceptions?

We have demos that demonstrate how to wire your Kendo Grid to an odata service and you can find them here and compare to your case:

https://github.com/telerik/kendo-examples-asp-net

https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid

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
Chris
Top achievements
Rank 1
answered on 17 Mar 2015, 06:28 AM
Hi Petur,

I have submitted more details in my support ticket: 916422.

Thanks
0
Petur Subev
Telerik team
answered on 18 Mar 2015, 04:00 PM
Hi,

In the other thread I can see that you have the following exception thrown from the server:

An unexpected 'EndOfInput' node was found when reading from the JSON reader. A 'StartObject' node was expected.

Did you resolve this issue? Please provide the related details, if possible a live URL which we can visit and see if Kendo is configured incorrectly.

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!
 
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Chris
Top achievements
Rank 1
Share this question
or