Hello,
I recently started using syncfusion grid and not able to figure out how to show a dialog box after any insert ,delete or update event. I am using InertURL ,UpdateURL and RemoveURL function to save data to my database. i am looking for something like Ajax onSuccess() method which gets triggered after a ajax call. how do i achieve this using syncfusion InsertUrl() and other methods.
this is how my grid looks like.
@(Html.EJ().Grid<Designation>("FlatGrid")
.Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.dataSource).InsertURL(Url.Action("DialogInsert", "DesignationMaster", null, Request.Url.Scheme)).UpdateURL(Url.Action("UpdateQuestion", "DesignationChange", null, Request.Url.Scheme)).RemoveURL("DeleteQuestion").Adaptor(AdaptorType.RemoteSaveAdaptor))
.EnableAltRow()
.AllowFiltering()
.AllowSorting()
.GridLines(GridLines.Horizontal)
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().ShowConfirmDialog(true).EditMode(EditMode.DialogTemplate).DialogEditorTemplateID("#template"); })
.ContextMenuSettings(contextMenu =>
{
contextMenu.EnableContextMenu();
})
.PageSettings(page =>
{
page.PageSize(15);
})
.AllowTextWrap()
.AllowResizeToFit()
.EnableHeaderHover()
.FilterSettings(filter => { filter.FilterType(FilterType.Excel); })
.AllowPaging()
.ClientSideEvents(eve =>
{
eve.ActionComplete("complete");
eve.RecordClick("recordClick");
eve.RecordDoubleClick("recordDoubleClick");
eve.ActionBegin("beginAction");
})
.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);
items.AddTool(ToolBarItems.Search);
});
})
.Columns(col =>
{
col.Field(p => p.designationCode).HeaderText("Designation Code").IsPrimaryKey(true).TextAlign(TextAlign.Left).ValidationRules(v => v.AddRule("required", true).AddRule("number", true)).Width(70).Add();
col.Field(p => p.description).HeaderText("Description").Width(90).ValidationRules(v => v.AddRule("required", true).AddRule("minlength", 3)).Add();
col.Field(p => p.salaryDesc).HeaderText("Salary Type").EditType(EditingType.Dropdown).Width(65).Add();
col.Field(p => p.salaryCode).HeaderText("Salary Type").EditType(EditingType.Dropdown).Width(65).Visible(false).Add();
col.Field(p => p.normalWokringHrs).HeaderText("Salary Type").Width(65).Visible(false).Add();
col.Field(p => p.ramadanWorkingHrs).HeaderText("Salary Type").Width(65).Visible(false).Add();
col.Field(p => p.dailyRate).HeaderText("Salary Type").Width(65).Visible(false).Add();
col.Field(p => p.hourlyRate).HeaderText("Salary Type").Width(65).Visible(false).Add();
col.Field(p => p.otAllowed).HeaderText("O.T.").Width(40).EditType(EditingType.Boolean).ValidationRules(v => v.AddRule("required", true).AddRule("minlength", 3)).Add();
col.Field(p => p.jobCategoryCode).HeaderText("JCC").EditType(EditingType.Dropdown).Width(55).Add();
col.Field(p => p.jobCategoryDesc).HeaderText("JCD").Width(85).ValidationRules(v => v.AddRule("required", true).AddRule("minlength", 3)).Add();
})
)
and this is my dialog box
<div class="control">
@(Html.EJ().Dialog("ErrorList").ShowOnInit(false)
.ContentTemplate(
@<div class="cnt">
Do you really leave the session?
</div>
)
.Title("Error List")
.Animation(animate => animate.Show(show => show.Duration(500).Effect("slide")).Hide(hide => hide.Duration(500).Effect("fade")))
.ShowFooter().FooterTemplateId("sample")
)
</div>
my controller returns a Serialized list of errors if some error occurs while performing server side operation. please tell me where should i write $("#ErrorList").ejDialog("open") function in script to show these errors.
Thanks.