Crud Controller Notification display

Hi (again),
is it possible to return notifications from the CRUD Controller of Schedule?

Let's say an insert action is validated server side only and cancelled, or an exception has been thrown - how could present a message to the user? I thought I might be able to "hijack" the reminder boxes but it does not seem possible that way.

Thanks very much, I hope you can point me into the right direction.

3 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team October 31, 2017 06:21 AM UTC

Hi Stefan, 
 
Thank you for contacting Syncfusion support. 
 
We would like to inform that currently there is no option to notify the user if the request fails, kindly validate the request at server side and alert the user 
 
Regards, 
Karthigeyan 



ST Stefan November 2, 2017 12:51 PM UTC

I have now solved this using SignalR and PNotify. I've written a short overview on the How on Stackoverflow if anyone is interested. 

https://stackoverflow.com/questions/47044277/notifying-clients-from-boxed-syncfusion-ajax-call/47075666#47075666



KK Karthigeyan Krishnamurthi Syncfusion Team November 6, 2017 02:26 PM UTC

Hi Stefan, 
 
We are happy to hear from you. 
 
As said earlier there is no default option to alert the user on request fail. We have performed the CRUD operation on Ajax post to alert the user which can be download from the below location. 

<Code> 
beforeAppointmentCreate: "onCRUDActions", 
beforeAppointmentChange: "onCRUDActions", 
beforeAppointmentRemove: "onCRUDActions" 
 
function onCRUDActions(args) { 
    args.cancel = true; var UserData; 
    if (args.currentAction == "add" || args.type == "beforeAppointmentCreate") { 
        var appoint = []; 
        appoint[0] = !(ej.isNullOrUndefined(args.appointment[0])) ? args.appointment[0] : args.appointment; 
        UserData = { "added": appoint, "changed": null, "removed": null }; 
    } 
    else if (args.currentAction == "edit" || args.currentAction == "editSeries") { 
        var appoint = []; 
        if (args.currentAction == "editSeries") { 
            var app = new ej.DataManager(this._currentAppointmentData).executeLocal(new ej.Query().where("ParentId", ej.FilterOperators.equal, args.appointment.changed[0].ParentId)); 
            for (var i = 0 ; i < app.length ; i++) { 
                if (app[i][this._appointmentSettings["recurrenceRule"]].indexOf("RECUREDITID") != -1) { 
                    appoint.push(app[i]); 
                } 
            } 
        } 
        UserData = { "added": null, "changed": args.appointment.changed, "removed": (appoint.length > 0) ? appoint : null }; 
    } 
    else if (args.currentAction == "delete" || args.currentAction == "deleteSeries") { 
        var appoint = new ej.DataManager(this._currentAppointmentData).executeLocal(new ej.Query().where("ParentId", ej.FilterOperators.equal, args.appointment.ParentId)); 
        UserData = { "added": null, "changed": null, "removed": appoint }; 
    } 
    else if (args.currentAction == "editOccurrence") { 
        var appoint = new ej.DataManager(this._currentAppointmentData).executeLocal(new ej.Query().where("ParentId", ej.FilterOperators.equal, args.appointment.changed[0].ParentId)); 
        args.appointment.changed[0]["Recurrence"] = true; 
        UserData = { "added": args.appointment.changed, "changed": appoint, "removed": null }; 
    } 
    else if (args.currentAction == "deleteOccurrence") { 
        var appoint = new ej.DataManager(this._currentAppointmentData).executeLocal(new ej.Query().where("ParentId", ej.FilterOperators.equal, args.appointment.ParentId)); 
        UserData = { "added": null, "changed": appoint, "removed": null }; 
    } 
 
    $.ajax({ 
        url: '/Home/CRUD/', 
        data: JSON.stringify(UserData), 
        type: 'POST', 
        traditional: true, 
        contentType: 'application/json', 
        success: function (data) { 
            if (data.status && data.status != "") { 
                var obj = $("#Schedule1").data("ejSchedule"); 
                obj.refreshAppointments(); 
                alert(data.status); 
            } 
        }, 
        failure: function (data) { 
            alert("Failure occurred") 
        }, 
        error: function (data) { 
            alert("Error Occurred") 
        } 
    }); 
} 
</Code> 

Regards, 
Karthigeyan 


Loader.
Up arrow icon