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,
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,