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

RemoteSaveAdapter with ejGrid not working on Insert

Hi

I have an ejGrid whose source has been set to a DataManager and using the remoteSaveAdapter.

When inserting a new record, the Grid seems to lose the record. My MVC controller Insert action returns all records from the database. Even when I change this to only return the record inserted the Grid still loses the record.

What am I doing wrong?

$(function () {
        $("#Grid").ejGrid({
          dataSource: ej.DataManager({
            json: Data, 
            updateUrl: projectionPage.urlFor("STAND0101/Update"), 
            insertUrl: projectionPage.urlFor("STAND0101/Insert"),
            removeUrl: projectionPage.urlFor("STAND0101/Delete"),
            adaptor: "remoteSaveAdaptor"        
          }),
          allowPaging: false,
          enableAltRow: false,
          allowSorting: true,
         ...


public ActionResult Insert(Model value)
    {
     
        var busEnt = DataServices.BusinessEntities.Save(value);
       
        return Json(FetchBusinessEntities(), JsonRequestBehavior.AllowGet);
          

      return Json(response);
    }

2 Replies

DT Damien Turnbull February 7, 2019 05:02 PM

Wait! I just got it working.

I just realised I didn't have a column marked as a primaryKey. As soon as I added that and then changed the controller action to return just the inserted record it worked.


VN Vignesh Natarajan Syncfusion Team February 8, 2019 01:04 AM

Hi Damien, 

Thanks for using Syncfusion products.  

We are glad to hear that your query has been resolved.  

Refer our UG and KB (knowledge base) document for the importance of PrimaryKey while Editing. 



Please get back to us if you have further queries. 

Regards, 
Vignesh Natarajan 


Loader.
Live Chat Icon For mobile
Up arrow icon