").kendoWindow({ ... content: "abc.html?" + $.param(params" /> ").kendoWindow({ ... content: "abc.html?" + $.param(params" /> ").kendoWindow({ ... content: "abc.html?" + $.param(params"/>

Window close cause error 'undefined' is undefined in jquery

395 Views Asked by At

I'm using the kendo ui for window popup. initialise like below:

 $("<div id='windowElement'/>").kendoWindow({
      ...
      content: "abc.html?" + $.param(params),
      close: function (e) {
          this.destroy();
      }
 });

Inside the popup, I have a custom button with function like this:

 $("#close").click(function(){
     window.parent.$("#thewindow").data("kendoWindow").close();
 });

When I click on the button it will trigger the window close function and destroy the widget, but currently it keep on prompt an error pointing to this line in my jquery saying that 'undefined' is undefined for the variable ret

 if (ret !== undefined) {
    if ((event.result = ret) === false) {
        event.preventDefault();
         event.stopPropagation();
     }
  }

However, when I clicking on the X button of the window which is calling the same close function the error will not hit, the error will hit when I click on the custom button. But both of them are calling the same close function of the window.

jquery version that I'm using is v3.0.0.

1

There are 1 best solutions below

0
CMartins On

Try these changes in your close function:

$("#close").click(function(){
    var myWindow = $("#thewindow").data("kendoWindow");
    myWindow.close();
});