I found this documentation for information to create KendoUI grid with CRUD operations. It seems that there is Product model behind this. But I did not find any information or examples about how to create kendo.data.model for remote data (Odata service). Could anyone help with this?
read: "/Products",
update: {
url: "/Products/Update",
type: "POST"
},
destroy: {
url: "/Products/Destroy",
type: "POST"
},
create: {
url: "/Products/Create",
type: "POST"
}
BR
Marko
21 Answers, 1 is accepted
Currently CRUD operations with OData is not supported. We are working on solution that will allow CRUD operations with OData services.
All the best,
Nikolay Rusev
the Telerik team
You can find sample app implemented on the link bellow:
https://github.com/telerik/kendo-examples-asp-net
Greetings,
Nikolay Rusev
the Telerik team
OData CRUD will be supported in the next official release - Q1 2011.
Regards,Atanas Korchev
the Telerik team
Do you mean Q1 2012?
Of course. I meant Q1 2012. It seems I am still living in the past :)
Regards,Atanas Korchev
the Telerik team
From what I can tell, it is not. :(
No it is not supported in the beta.
Regards,Atanas Korchev
the Telerik team
OData CRUD is now supported. There is a demo project here: https://github.com/telerik/kendo-examples-asp-net/tree/master/grid-odata-crud
Regards,Atanas Korchev
the Telerik team
We can't really help without seeing some code.
All the best,Atanas Korchev
the Telerik team
<div id="example" class="k-content">
<div id="gridPaxEdit"></div>
<script>
$(document).ready(function () {
var crudServiceBaseUrl = DataService + "/EventPaxBreakDowns",
dataSource = new kendo.data.DataSource({
type: "odata",
transport: {
read: {
url: crudServiceBaseUrl,
dataType: "jsonp",
data: {
$expand: "Country"
}
},
update: {
url: function (data) {
return crudServiceBaseUrl + "(" + data.PaxBDID + ")";
}
},
create: {
url: crudServiceBaseUrl
},
destroy: {
url: function (data) {
return crudServiceBaseUrl + "(" + data.PaxBDID + ")";
}
}
},
filter: { filters: [{ field: "EventID", operator: "eq", value: parseInt($("#EventId").val()) }]},
serverPaging: true,
batch: false,
schema: {
model: {
id: "PaxBDID",
fields: {
PaxBDID: { editable: false, nullable: true },
EventID: { type: "number" },
MilitaryPlanned: { type: "number" },
MilitaryActual: { type: "number" },
CivilianPlanned: { type: "number" },
CivilianActual: { type: "number" },
Country: {}
}
}
}
});
$("#gridPaxEdit").kendoGrid({
dataSource: dataSource,
height: 250,
pageable: true,
toolbar: ["create"],
columns: [
{
field: "Country",
template: "#=Country.Title#",
editor: PaxCountryDropDown
}, {
field: "MilitaryPlanned",
title: "Military Planned"
}, {
field: "MilitaryActual",
title: "Military Actual"
}, {
field: "CivilianPlanned",
title: "Civilian Planned"
}, {
field: "CivilianActual",
title: "Civilian Actual"
},
{ command: ["edit", "destroy"], title: " ", width: "210px" }
]
,
editable: "inline"
});
function PaxCountryDropDown(container, options) {
$('<input data-text-field="Title" data-value-field="CountryID"/>')
.appendTo(container)
.kendoComboBox({
dataType: 'json',
dataTextField: "Title",
dataValueField: "CountryID",
autoBind: false,
minLength: "1",
suggest: true,
highLightFirst: true,
filter: "startswith",
dataSource: {
transport: {
read: "/_LoadCountryData"
},
serverFiltering: true
}
});
}
});
</script>
</div>
Side note: I really would like to to Load On demand through ODATA with the Combobox I have as well.
What exactly happens when say an update operation is executed? Do you see any JavaScript errors in your browser development tools console? Did you check what the response of the HTTP request is?
On a side note make sure your page and OData service are in the same domain. Cross-domain OData requests will not work because you cannot perform OData CUD via JSONP.
Atanas Korchev
the Telerik team
I am out of ideas. Does the github project work as expected at your side? Could you modify it so it mimics your own scenario which does not work?
All the best,Atanas Korchev
the Telerik team
///FINAL UPDATE
The github example is not doing CUD at all. It is behaving the same as my project. Any ideas folks??
"A supported MIME type could not be found that matches the content type of the response. None of the supported type(s) 'application/atom+xml;type=entry, application/atom+xml, application/json;odata=verbose' matches the content type 'application/json'."
I was under the impression that JSONPSupportBehavior was supposed to take care of this both directions?
I am afraid that we are not able to determine what is wrong with your project. Kendo DataSource supports only JSON for response when binding to OData.
I am attaching the project from the GitHub library. Seems to be perfectly execute all CRUD operations on our end.
Regards,
Nikolay Rusev
the Telerik team