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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to refresh grid data after delete condition

Thread ID:

Created:

Updated:

Platform:

Replies:

130849 Jun 7,2017 06:27 AM UTC Jun 8,2017 12:11 PM UTC ASP.NET MVC 2
loading
Tags: Grid
Dongil Shin
Asked On June 7, 2017 06:27 AM UTC

Hi I'm curious about the delete button in grid.

my code is as follows.

@(Html.EJ().DataManager("dmPersonNames").URL("/Person/GetPersonNames").Adaptor(AdaptorType.UrlAdaptor)

...
.ClientSideEvents(e => { e.Create("onCreate").ActionBegin("onBegin").BeginEdit("onBeginEdit").EndEdit("onEndEdit")

.ActionComplete("onComplete").RowSelecting("cancelSelectionIfDisabled"); })


function onComplete(args) {

if (args.requestType == "delete") {




location.reload();

}

}

my Question is how to reload/refresh data in the grid from server after delete action.

the delete action does not delete the record under some conditions. so, I need to make sure the reload/refresh data in the grid from server again.

However, location.reload makes page flickering, so I'm looking for better solution.

Thank you very much.

Kind Regards,





Prasanna Kumar Viswanathan [Syncfusion]
Replied On June 8, 2017 12:07 PM UTC

Hi Dongil, 

Thanks for contacting Syncfusion support. 

According to your code example we found that you have used UrlAdaptor in Grid. In URL Adaptor you can map CRUD operation in Grid to Server-Side Controller action using the properties “InsertURL”, “UpdateURL” and “RemoveURL”. Once you perform delete operation in Grid it automatically call the dataSource URL and refresh the data in Grid.  
 
Find the code example and sample:  
 
 
@(Html.EJ().Grid<object>("HierarchyGrid") 
        .Datasource(ds => ds.URL("/Grid/Data").UpdateURL("/Grid/Update").InsertURL("/Grid/Insert").RemoveURL("/Grid/Delete").Adaptor(AdaptorType.UrlAdaptor)) 
        .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); }) 
        .AllowPaging() 
        ------------------------- 
       .Columns(col => 
        { 
            -------- 
       }) 
              
) 
 
---------------------------------------------------- 
public ActionResult Update(EditableOrder value) 
        { 
            OrderRepository.Update(value); 
            return Json(value, JsonRequestBehavior.AllowGet); 
        } 
        //Insert action 
        public ActionResult Insert(EditableOrder value) 
        { 
            OrderRepository.Add(value); 
            return Json(value, JsonRequestBehavior.AllowGet); 
        } 
        //Delete Action 
        public ActionResult Delete(int key) 
        { 
            OrderRepository.Delete(key); 
            return Json(key, JsonRequestBehavior.AllowGet); 
        } 


Regards, 
Prasanna Kumar N.S.V 
 


Prasanna Kumar Viswanathan [Syncfusion]
Replied On June 8, 2017 12:11 PM UTC

Hi Dongil, 

Please ignore the previous update. 

According to your code example we found that you have used UrlAdaptor in Grid. In URL Adaptor you can map CRUD operation in Grid to Server-Side Controller action using the properties “InsertURL”, “UpdateURL” and “RemoveURL”. Once you perform delete operation in Grid it automatically call the dataSource URL and refresh the data in Grid.  
 
Find the code example and sample:  
 
 
@(Html.EJ().Grid<object>("HierarchyGrid") 
        .Datasource(ds => ds.URL("/Grid/Data").UpdateURL("/Grid/Update").InsertURL("/Grid/Insert").RemoveURL("/Grid/Delete").Adaptor(AdaptorType.UrlAdaptor)) 
        .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); }) 
        .AllowPaging() 
        ------------------------- 
       .Columns(col => 
        { 
            -------- 
       }) 
              
) 
 
---------------------------------------------------- 
public ActionResult Update(EditableOrder value) 
        { 
            OrderRepository.Update(value); 
            return Json(value, JsonRequestBehavior.AllowGet); 
        } 
        //Insert action 
        public ActionResult Insert(EditableOrder value) 
        { 
            OrderRepository.Add(value); 
            return Json(value, JsonRequestBehavior.AllowGet); 
        } 
        //Delete Action 
        public ActionResult Delete(int key) 
        { 
            OrderRepository.Delete(key); 
            return Json(key, JsonRequestBehavior.AllowGet); 
        } 


Regards, 
Prasanna Kumar N.S.V 
 


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

;