Hi,
I have noticed that when an update is required, the request sent to the web api endpoint is slightly non-standard from a REST API perspective (I think!) - instead of making a PUT to (for example) api/orders/5 (where 5 is the id of the order to update), it makes a PUT to api/orders and places the id in the json body.
Is it possible to configure the grid to place the id in url (as above)?
Thanks in advance :)
[Index.cshtml]
<div>
<ejs-grid id="Grid" toolbar="@(new List<string>() { "Add", "Update", "Cancel" })" allowGrouping="true" allowFiltering="true" load="load">
<e-data-manager url="/api/Orders/" adaptor="WebApiAdaptor" crossdomain="true"></e-data-manager>
...
</ejs-grid>
</div>
<script>
window.customAdaptor = new ej.data.WebApiAdaptor();
customAdaptor = ej.base.extend(customAdaptor, {
update(dm, keyField, value, tableName) {
return {
type: 'PUT',
url: dm.dataSource.url + value[keyField], //This will generate the “PUT” action request as “api/Orders/5”
data: JSON.stringify(value)
};
}
});
</script>
<script>
function load(args) {
this.dataSource.adaptor = customAdaptor;
}
</script>
|