BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi James,
Thanks for using Syncfusion products,
Query 1:
I am having trouble with editing a
row in a Grid control. I am using web api odata controllers. I was able to
successfully load and display the grid with data from the datasource but when I
try to update a row and save the correct method for the controller is called
but the "Delta patch" attribute is always null.
"public IHttpActionResult Put([FromODataUri] int key,
Delta patch)"
The key passed is correct. What am i missing to be able to
update?
We have analyzed your provided code
, we glad to achieve your requirement by using “customAdaptor with Grid load events”. We have
created a sample as ”Web api controller with edit options enabled in
EjMVCGrid”.
The Custom adaptor is for Grid datasource to pass values to
Web Api controller for Edit operation. Please refer the following code
snippets.
[cshtml] <script src="~/Scripts/ej/CustomAdaptor.js">script> @*refer customAdaptor*@ @(Html.EJ().Grid<object>("Grid") .Datasource(ds
=> ds.URL("Api/Orders")) .EditSettings(e=>
e.AllowEditing().AllowDeleting().AllowAdding()) .ClientSideEvents(e
=> e.Load("load")) .AllowPaging() .Columns(col
=>
{
. . . })) <script type="text/javascript">
function load() {
this.model.dataSource.adaptor
= new
adaptor1();//grid loads with
customAdaptor
} script> [web api] public class OrdersController : ApiController
{
// GET api/
NORTHWNDEntities1 db = new NORTHWNDEntities1();
public PageResult<Order> Get(ODataQueryOptions opts)
{
var results
= opts.ApplyTo(db.Orders.AsQueryable());
var data
= db.Orders.AsQueryable();
return
new PageResult<Order>((IEnumerable<Order>)results,
Request.GetNextPageLink(), data.Count());
}
// Edit api/
public
void Put(Order value)
{
db.Entry(value).State = EntityState.Modified;
db.SaveChanges();
}
} } |
For your convenience we have attached a sample and the same
can be downloaded from the link:
Sample Location: Sampl124550.zip
Query
2:
also the
summary row does not calculate a value
Sorry about the inconvenience caused.
Currently we do not have support for Summary
Calculation in OData request.
Please let us know if you have any queries,
Regards,
J.Mohammed Farook