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.
Unfortunately, activation email could not send to your email. Please try again.

Refresh Grid after Edit

Thread ID:

Created:

Updated:

Platform:

Replies:

128446 Jan 23,2017 09:17 AM Jan 24,2017 07:10 AM ASP.NET Core 1
loading
Tags: Grid
Nicholas Picardi
Asked On January 23, 2017 09:17 AM

Hi all, 

It's possible refresh grid after edit command?

This is my code: 

 @{Html.EJ().Grid<Object>("FlatGrid")
                                        .Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.data).UpdateURL("/Home/CellEditUpdate").InsertURL("/Home/CellEditInsert").RemoveURL("/Home/CellEditDelete").Adaptor(AdaptorType.RemoteSaveAdaptor))
                                        .AllowPaging()
                                        .AllowResizeToFit()
                                        .AllowTextWrap()
                                        .TextWrapSettings(wrap => { wrap.WrapMode(WrapMode.Both); })
                                        .AllowSorting()
                                        .AllowScrolling()
                                        .ScrollSettings(col => { col.Width(1800).Height(460); })
                                        .AllowSelection()
                                        .SelectionType(SelectionType.Single)
                                        .IsResponsive(true)
                                        .EnableResponsiveRow(true)
                                        .AllowFiltering()
                                        .FilterSettings(filter => { filter.FilterType(FilterType.Excel); })
                                        .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })
                                        .ToolbarSettings(toolbar =>
                                        {
                                            toolbar.ShowToolbar().ToolbarItems(items =>
                                            {
                                                items.AddTool(ToolBarItems.Edit);
                                                items.AddTool(ToolBarItems.Update);
                                              //items.AddTool(ToolBarItems.Delete);
                                          });
                                        })
                                        .Columns(col =>
                                        {
                                            col.Field("Id").HeaderText("Id").IsPrimaryKey(true).Visible(false).Add();
                                            col.Field("Cabin").HeaderText("Cabin").AllowEditing(false).Width(100).Add();
                                            col.Field("Line").HeaderText("Line").AllowEditing(false).AllowResizing().Width(100).Add();
                                            col.Field("Turbine").HeaderText("Turbine").AllowEditing(false).AllowResizing().Width(100).Add();
                                            col.Field("StatusCode").HeaderText("Status code").AllowEditing(false).AllowResizing().Width(150).Add();
                                            col.Field("AlarmDescription").HeaderText("Main fault description").AllowEditing(false).AllowResizing().Width(150).Add();
                                            col.Field("AddnAllarmDescription").HeaderText("Additional fault description").AllowEditing(false).AllowResizing().Width(150).Add();
                                            col.Field("FalckTaxonomy").HeaderText("Allocated taxonomy").AllowEditing(false).AllowResizing().Width(150).Add();
                                            col.Field("Timekey").HeaderText("Timekey").AllowEditing(false).AllowResizing().Width(125).Add();
                                            col.Field("dt_from").HeaderText("Start Date").Format("{0:dd/MM/yyyy HH:mm:ss}").AllowEditing(false).AllowResizing().Width(150).Add();
                                            col.Field("dt_to").HeaderText("End Date").Format("{0:dd/MM/yyyy HH:mm:ss}").AllowEditing(false).AllowResizing().Width(150).Add();
                                            col.Field("KindofActivity").HeaderText("Kind of Activity").EditType(EditingType.Dropdown).DataSource((IEnumerable<object>)ViewBag.kindofactivities).AllowResizing().Width(150).Add();
                                            col.Field("ReasonDescription").HeaderText("Reason Description").AllowResizing().Width(150).Add();
                                            col.Field("MA_StatusCode").HeaderText("Reallocated status code").AllowEditing(true).EditType(EditingType.Dropdown).DataSource((IEnumerable<object>)ViewBag.alarms).ForeignKeyField("MA_StatusCode").AllowResizing().Width(150).Add();
                                          //col.Field("Reallocated_FaultDescription").HeaderText("Reallocated Fault Description").EditType(EditingType.Dropdown).DataSource((List<object>)ViewBag.alarms1).AllowResizing().Width(150).Add();
                                          //col.Field("Reallocated_AddFaultDescription").HeaderText("Reallocated Add Fault Description").EditType(EditingType.Dropdown).DataSource((List<object>)ViewBag.alarms2).AllowResizing().Width(150).Add();
                                          //col.Field("Reallocated_Taxonomy").HeaderText("Reallocated Taxonomy").AllowEditing(false).AllowResizing().Width(150).Add();
                                          col.Field("FullDescription").HeaderText("Reallocated Full Description").EditType(EditingType.Dropdown).DataSource((IEnumerable<object>)ViewBag.FullAlarm).ForeignKeyField("FullDescription").AllowResizing().Width(400).Add();
                                            col.Field("timekey_changed").HeaderText("Timekey Changed").EditType(EditingType.Numeric).ValidationRules(v => v.AddRule("range", "[1,6]").AddRule("required", true)).Width(150).Add();
                                            col.Field("Timekey_ReasonDescription").HeaderText("Timekey Reason Description").AllowResizing().Width(150).Add();
                                            col.Field("Unallocated_alarms_flag").HeaderText("Unallocated_alarms_flag").AllowResizing().Visible(false).Width(150).Add();
                                            col.Field("ServiceCompany").HeaderText("Service Company").EditType(EditingType.Dropdown).DataSource((IEnumerable<object>)ViewBag.service).AllowResizing().Width(150).Add();
                                            col.Field("Responsability").HeaderText("Responsability").AllowResizing().Width(150).Add();
                                            col.Field("sk_plant").HeaderText("sk_plant").AllowResizing().Visible(false).Add();
                                        }).Render();
}


Thanks,
Nicholas

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On January 24, 2017 07:10 AM

Hi Nicholas,  
 
Thanks for contacting Syncfusion Support. 
 
Usually, Grid will refresh its content once after updating any changes to records in the server and update the same to corresponding record. However, we can also manually refresh the Grid content using the refreshContent method of the Grid. This method can be called in the ActionComplete event of the Grid while requestType as “save”. Refer to the following API Reference. 
 
@{Html.EJ().Grid<Object>("FlatGrid") 
                .Datasource(ds => 
                    ds.Json((IEnumerable<object>)ViewBag.data) 
                    .UpdateURL("/Home/CellEditUpdate") 
                    .InsertURL("/Home/CellEditInsert") 
                    .RemoveURL("/Home/CellEditDelete") 
                    .Adaptor(AdaptorType.RemoteSaveAdaptor)) 
                     .. . .  
                 .. . . . 
                .ClientSideEvents(events => events.ActionComplete("Complete")) 
                .Render(); 
} 
 
<script> 
 
    function Complete(args) { 
        if (args.requestType == "save") 
            this.refreshContent(); 
    }; 
 
</script> 


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.

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.

;