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.
Syncfusion Feedback

MVC grid EditMode.Dialog insert action freezes after server error

Thread ID:

Created:

Updated:

Platform:

Replies:

123761 Apr 19,2016 06:52 AM UTC Apr 20,2016 09:44 AM UTC ASP.NET MVC 1
loading
Tags: Grid
Dimitris Karathanasis
Asked On April 19, 2016 06:52 AM UTC

Hello

we are using the latest version of MVC Components. We have a page with the following code

@(Html.EJ().Grid<LessonGroupOutput>("GroupLessonsGrid")
    .Locale("el-GR")
    .Datasource(ds => ds.Json((IEnumerable<object>)Model)
        .InsertURL("LessonGroups/Create")
        .UpdateURL("LessonGroups/Update")
        .RemoveURL("LessonGroups/Delete")
        .Adaptor(AdaptorType.RemoteSaveAdaptor))
    .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Dialog); })
    .ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items =>
                {
                    items.AddTool(ToolBarItems.Add);
                    items.AddTool(ToolBarItems.Edit);
                    items.AddTool(ToolBarItems.Delete);
                }))
    .AllowPaging()
    .PageSettings(page => page.PageSize(20))
    .AllowSorting()
    .Columns(col =>
    {
        col.Field("Id").HeaderText("Κωδικός").IsPrimaryKey(true).TextAlign(TextAlign.Left)
            .ValidationRules(v => v.AddRule("required", true).AddRule("number", true))
            .Width(20).Add();
        col.Field("Name").HeaderText("Όνομα").Width(180).Add();
    })
            .ClientSideEvents(events => { events.ActionFailure("OnActionFailure"); })
)
 
<script>
    function OnActionFailure(args) {
        alert(args.error.status + ':' + args.error.statusText, 'error');
    }
</script>


When we create a new object, the dialog form appears, we set the data and send them through the ajax call to the server.When the server responds with an error (throws dbexception for example) the triggered alert shows the error but when we close the alert dialog the page still shows the insert dialog form with the circular waiting popup. Is there a way to cancel the insert dialog form and get back to the grid?


Thanks

Venkatesh Ayothi Raman [Syncfusion]
Replied On April 20, 2016 09:44 AM UTC

Hi Dimitris,

Thanks for contacting Syncfusion support.

If any server side error is thrown then grid waiting popup will load and to hide the waiting popup and get back to the grid we can use the actionFailure event. This event triggered for every grid action server failure event. Refer to the sample, code sample and Help document,

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/7z/RemoteSaveAdaptorSample137393794


Code example:

<Grid>


@(Html.EJ().Grid<object>("FlatGrid")

                   .Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.datasource).UpdateURL("/Grid/Update")

                   .InsertURL("/Grid/Inser").RemoveURL("/Grid/Remove").Adaptor(AdaptorType.RemoteSaveAdaptor))

                   .AllowPaging()

                       .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Dialog); })

                  

                    })


                  . . . . .


                    .ClientSideEvents(eve=>eve.ActionFailure("actionFailure"))

                

                 . . . . .

               

)


<actionFailure event>


function actionFailure(args) {


        alert(args.error.error().statusText);


        $("#" + this._id + "_dialogEdit").ejDialog("close"); // Close the dialog edit form



        this.element.ejWaitingPopup("hide");//disable the Waiting popup

    }


Help document: http://help.syncfusion.com/js/api/ejgrid#events:actionfailure

If we misunderstood your query, then provide more details about that.

Regards,
Venkatesh Ayothiraman.

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

;