We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Trouble with the grid examples using RemoteSave Adapter

Hi,

I'm having trouble with the grid examples using Version 14.2.0.28.

Grid / Editing / Inline Editing
The controller code for update is:
public ActionResult NormalUpdate(EditableOrder value)
        {
            OrderRepository.Update(value);
            var data = OrderRepository.GetAllRecords();
            return Json(value, JsonRequestBehavior.AllowGet);
        }
Why set data and not use it? In this example, I can modify the object "value" and those new values are displayed in the grid as expected.
 
Essential Grid for ASP.Net MVC.pdf at 1.10.62 RemoteSave Adapter on page 124 code for update is:
public ActionResult Update(EditableOrder value)
      {
           OrderRepository.Update(value);
           var data = OrderRepository.GetAllRecords();
           return Json(data, JsonRequestBehavior.AllowGet);
      }

When I comment out the update() routine the data object is returned to it's original values prior to user updates, but the grid still shows the user modifications. How can I force an update of the grid's data? I've encountered the same problem with inline and batch editing. Batch would be my preferred method in this application.

Thanks,

Bill



3 Replies

VA Venkatesh Ayothi Raman Syncfusion Team August 19, 2016 11:39 AM UTC

Hi Bill, 

Thank you for contacting Syncfusion support. 

Yes, we are able to reproduce the reported query and this is a behavior of remote save adaptor. If we return IEnumerable (“data”) then nothing can be changed in Grid data source and it just shows the local modifications in Grid. Meanwhile if we return object (“value”) then Grid will use the returned value to update the view. This is helpful when we are doing some operation to modify the given value before updating in DB.  
We suspect you do some operation in server side and show original value instead of the user modified value from client. So we suggest you to return the original values from server side instead of the user modified based on your condition as follows. 
 
Code example: 

public ActionResult Update(EditableOrder value) 
              { 
                  if (value.EmployeeID > 5) 
                  { 
                      OrderRepository.Update(value); //Update in DB if EmployeeID is gt 5. 
                  } 
                  else // Else return the Corresponding original record from DB 
                      value = OrderRepository.GetAllRecords().Where(o => o.OrderID == value.OrderID).SingleOrDefault(); 
                 
                 return Json(value, JsonRequestBehavior.AllowGet); 
              } 
   



Regards, 
Venkatesh Ayothiraman. 



BI Bill August 20, 2016 01:13 AM UTC

Thanks Venkatesh ,

I have a collection of about 60 elements. The user needs to continually update the elements to reflect price changes. There is a last change date that is assigned by the server that needs to be passed back to the grid. The grid's bulk update and sorting would be a great solution. Updating each item one at a time would not be optimal. The lag time of going back and forth to the server would be very undesirable. Is there any way that I can get this functionally?

Thanks,
Bill 


VA Venkatesh Ayothi Raman Syncfusion Team August 22, 2016 03:42 PM UTC

Hi Bill, 

Thanks for the update. 

In RemoteSaveAdaptor, we have passed the values to server side only on editing the record. So,other operations like filtering,sorting, paging are  performed in client side. We have to change/Modify the editable values in server side only for inline, Dialog and external editing. But bulk editable values are not synchronically in RemoteSaveAdaptor and its very tedious process to synchronize the data. So we suggest you to use URL adaptor for this. When using URL adaptor method paging,sorting, filtering should be handled in server side. And every grid action post request sends to server side. Please refer to the UG documentation for more information, 



Regards, 
Venkatesh Ayothiraman.   


Loader.
Live Chat Icon For mobile
Up arrow icon