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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

refreshing data in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

130676 May 25,2017 04:15 AM UTC May 26,2017 03:41 PM UTC ASP.NET MVC 1
loading
Tags: Grid
Dongil Shin
Asked On May 25, 2017 04:15 AM UTC

Hi, I have a problem in refreshing grid. once the page reloads, the grid's save/edit/delete function works well.

but, sometimes if the page does not reload, the second action (edit/delete) do not call ajax update/delete function in backend.

I was adding a flag in javascript to manually reload page.
I think it's not a solution.

if the grid itself reload or refresh after calling ajax backend, the symtoms above might be resolved.

Please give me an idea or sample code..

Thank you in advance!

Kind Regards, 

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On May 26, 2017 03:41 PM UTC

Hi Dongil, 

Thanks for your interest in syncfusion support. 

We can achieve your requirement “while save/edit/delete  record into database, Grid data need to be refreshed” by using “remoteSaveAdaptor”. When we enable removeSaveAdaptor with editing enabled, the grid datasource will automatically refresh the Grid for each operations performed on grid which is the default behavior of the Grid. 
 
Please refer to the UG document:- 
 
 
Please refer to the code example:- 

Clientside:- 
@(Html.EJ().Grid<object>("Grid") 
           .Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.dataSource).UpdateURL("CellEditUpdate").InsertURL("CellEditInsert").RemoveURL("CellEditDelete").Adaptor(AdaptorType.RemoteSaveAdaptor)) 
          .AllowPaging() 
          .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); }) 
                    .ToolbarSettings(toolbar => 
                       { 
                           toolbar.ShowToolbar().ToolbarItems(items => 
                           { 
                               items.AddTool(ToolBarItems.Add); 
                               items.AddTool(ToolBarItems.Edit); 
                               items.AddTool(ToolBarItems.Delete); 
                               items.AddTool(ToolBarItems.Update); 
                               items.AddTool(ToolBarItems.Cancel); 
                           }); 
                       }) 
           
          .Columns(col => 
              { 
                  col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).Add(); 
                  col.Field("CustomerID").HeaderText("Customer ID").Add(); 
                  col.Field("Freight").HeaderText("Freight").EditType(EditingType.Numeric).Add(); 
                  col.Field("ShipCity").HeaderText("Ship City").Add(); 
                  col.Field("ShipCountry").HeaderText("Ship Country").Add(); 
              })) 
Serverside:- 
 
public class GridController : Controller 
    { 
        public ActionResult GridFeatures() 
        { 
 
            var DataSource = new NorthwindDataContext().OrdersViews.ToList(); 
            ViewBag.datasource = DataSource; 
            return View(); 
        } 
       
        public ActionResult CellEditUpdate(EditableOrder value) 
        { 
            OrderRepository.Update(value); 
            var data = OrderRepository.GetAllRecords(); 
            return Json(value, JsonRequestBehavior.AllowGet); 
        } 
 
        public ActionResult CellEditInsert(EditableOrder value) 
        { 
            OrderRepository.Add(value); 
            var data = OrderRepository.GetAllRecords(); 
            return Json(value, JsonRequestBehavior.AllowGet); 
        } 
 
        public ActionResult CellEditDelete(int key) 
        { 
            OrderRepository.Delete(key); 
            var data = OrderRepository.GetAllRecords(); 
            return Json(data, JsonRequestBehavior.AllowGet); 
        } 
 
     } 

We have prepared sample which can be downloaded from the below location:- 


After following the above solution, still facing any issue could you please share us the following details. 

1. Share your Grid code example(both in server and client side) 

2. When are you reloading the Grid. Explain the exact scenario have you faced the issue? 

3. Screenshot/Video regarding the issue. 

4. Replicate the issue in the above sample and revert us back. 

5. Stacktrace of the issue ,if any script error occurs. 

The provided details will helps us to analyze and provide you solution as early as possible.  


Regards, 

Farveen sulthana T

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;