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

Grid not updated after New Recorded is added

I'm using inline editing in the Grid.  When I insert a new record and after saving it, it disappears from the Grid.  I created a button with:
            var gridObj = $("#OneCloudGrid").ejGrid("instance");
It reappears after I press it!
Seems like the grid needs to be refreshed after an Insert to display the newly added record.  My question is, where would I place these lines of code so that I don't have to press the button after every add.  I would think actionComplete("add"), put that seems to fires right after the add new button is pressed, before the record is even saved.


3 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team February 3, 2017 12:52 PM UTC

Hi Michael, 

Thanks for contacting Syncfusion support. 

Before we proceed with your query, please confirm the following details 

1. You have mentioned when insert a new record and after saving it, it disappears from the Grid. So, are you using any adaptors like URL, remoteSave etc.? 
2. Code example of a Grid and controller. 
3. While using adaptors and if you face any exception on grid save action, Share the screenshot of an exception.   
4.  Have you enable isIdentity property for the primary key column? 
5. If possible, share the video demonstration of an issue. 
6. Essential Studio Version details.  

Prasanna Kumar N.S.V 

ML Michael Lambert February 8, 2017 06:08 PM UTC

Here is the controller data: (Full code attached)
        public ActionResult GetData(Syncfusion.JavaScript.DataManager dm)
            System.Collections.IEnumerable Data = db.Requests.ToList();
            sgDataResult result = new sgDataResult();
            Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations();
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
                Data = operation.PerformSorting(Data, dm.Sorted);
            if (dm.Where != null && dm.Where.Count > 0) //Filtering
                Data = operation.PerformWhereFilter(Data, dm.Where, dm.Where[0].Operator);
            if (dm.Search != null && dm.Search.Count > 0) //searching
                Data = operation.PerformSearching(Data, dm.Search);

            List<string> str = new List<string>();
            if (dm.Aggregates != null)
                for (var i = 0; i < dm.Aggregates.Count; i++)
                result.aggregate = operation.PerformSelect(Data, str);

            int count = Data.AsQueryable().Count();

            if (dm.Skip != 0)
                Data = operation.PerformSkip(Data, dm.Skip);
            if (dm.Take != 0)
                Data = operation.PerformTake(Data, dm.Take);
            result.count = count;
            result.result = Data;
            return Json(result, JsonRequestBehavior.AllowGet);

        public ActionResult Insert(Request value)
            value.Created = DateTime.Now;
            value.CreatedBy = ((AuthUser)Session["user"]).Name;
            value.ISChoice = "OneCloud";
            db.Requests.Add(value);   value of value.RequestID (which is the PK) = 0 - which is correct at this time
after SaveChanges the value of value.RequestID(PK) should be updated to the new PK value but it's still 0
            catch (Exception ex)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Database Error: " + ex.Data);
            return Json(value, JsonRequestBehavior.AllowGet);

View Data
                                .Datasource(ds => ds.URL(@Url.Action("GetData", "AdminOC")).UpdateURL(@Url.Action("Update", "AdminOC")).InsertURL(@Url.Action("Insert", "AdminOC")).Adaptor(AdaptorType.UrlAdaptor))
                                .EditSettings(edit => { edit.AllowEditing().AllowAdding(); })

            .Columns(col =>
                col.Field(p => p.RequestID).HeaderText("Request ID").AllowEditing(false).IsIdentity(true).IsPrimaryKey(true).TextAlign(TextAlign.Center).Width(93).Add();
                col.Field(p => p.Period).HeaderText("Period").Width(82).TextAlign(TextAlign.Center).EditType(EditingType.Dropdown).DataSource(Model.ddlists.nsPeriod).Add();

Attachment: Code_720aa7c4.zip

TS Thavasianand Sankaranarayanan Syncfusion Team February 9, 2017 04:01 PM UTC

Hi Michael, 

We have analyzed your query and we are unable to reproduce the reported issue in our end. If isIdentity is enabled in grid column, the newly added record will be added in the grid. 

We have attached a video link of sample execution and it will be downloadable in the below location. 
Please provide the following details, for better assistance. 
1.       Video demonstration of issue. 
2.       Clear replication  procedure of issue. 
3.       Essential studio version. 
4.       If possible, replicate the issue in the attached sample. 
We have prepared a sample for your convenience and it can be downloadable in the below location. 

Thavasianand S. 

Live Chat Icon For mobile
Up arrow icon