简体   繁体   English

Kendo UI-在requestEnd中显示通知

[英]Kendo UI - Displaying notification in requestEnd

Greeting All, 问候大家,

On Kendo Grid requestEnd is that possible if I call kendo notification when successful updating record? 在Kendo Grid上,如果在成功更新记录时调用kendo通知 ,是否可以请求end

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 道场演示

The problem is that you are specifying the variable notification within $(document).ready . 问题是您要在$(document).ready中指定变量notification 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) 函数完成后,变量notification将丢失(有关变量范围的更多信息,请阅读https://stackoverflow.com/a/500459/4944034

I did a minor change to your example and got a notification: 我对您的示例进行了较小的更改,并收到了通知:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM