Hi Dan,
Thanks for contacting Syncfusion support.
We have analyzed your query. We suggest you to use the “CustomAdaptor” which is extended from an “WebApiAdaptor”. In this custom adaptor we have defined a customized “update” method which will override the default update method of WebApiAdaptor. In this method we have customized the “url” for the “PUT” action based on your requirement. Please refer to the following sample code,
Please refer the screenshot below,
[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>
|
In the above code, we have used customadaptor in Grid which is extended from WebApiAdaptor. In the “load” event of Grid, we have set the customadaptor for Grid. Here we have customized the default “update” method of WebApiAdaptor. We have added “value[keyField]” which contains the id value to the “url” generated for the “PUT” action. Now the request url for “PUT” action will contain the id also, please refer the screenshot below,
Please get back to us if you need further assistance.
Regards,
J Mohammed Farook