Nixoderm
Nixoderm

Reputation: 355

Kendo UI - Displaying notification in requestEnd

Greeting All,

On Kendo Grid requestEnd is that possible if I call kendo notification when successful updating record?

In this Demo I try to implement it, but somehow after I updated to record it keep buffering and not displaying the notification.

Can someone help me to solve this problem? Thank you in advance!

I include the function just in case:

function KendoAlert(content) {
  $("<div></div>").kendoAlert({
    title: "Messages!",
    content: content
  }).data("kendoAlert").open();
}   

function KendoNotify(message) {
  notification.show({
     message: message
  }, "upload-success");
}

function onRequestEnd(e) {
  debugger;

  if (e.type == "update" && !e.response.Errors) {
    KendoNotify("Update Done!");
    //KendoAlert("Update Done!");
  }  
}  

Demo In Dojo

Upvotes: 0

Views: 479

Answers (1)

Carsten Franke
Carsten Franke

Reputation: 1669

The problem is that you are specifying the variable notification within $(document).ready. Once the function finishes, the variable notification is lost (read https://stackoverflow.com/a/500459/4944034 for more information about the scope of a variable)

I did a minor change to your example and got a notification:

var notification;
$(document).ready(function () {
  notification = $("#notification").kendoNotification({

Upvotes: 2

Related Questions