Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: kendoWindow is not a function

I'm trying to resolve a client-side issue that has me scratching my head. What happens is, on my form, I click a button to open a window, and I get the dreaded "TypeError: kendoWindow is not a function" error.

There are a few things I should mention about this environment before I post my code:

  • The button in question is contained within a DIV that is initially hidden. Therefore, the button does not exist as an object until it is visible.
  • The client-side code that controls this is actually contained within an XSLT that contains the OnClick event.
  • The XSLT is edited through a CMS, not directly in a file. If I'm not mistaken, the XSLT code is actually stored in the database, not in a file.
  • There are two different XSLTs: one for the parent window (for the sake of this post, I'll call this PARENT), and one for the hidden DIV code (I'll call this HIDDEN) that takes effect once it's visible.
So, here's the original code. (Note: I did not write this; yes, I realize that "window" should NOT be used as a variable name. Be that as it may, this did work previously, and I don't believe this is causing my issue.)

PARENT XSLT:

//This is contained within $(document).ready(function()
var window = $("#Sponsor").kendoWindow({
height: "100px",
modal: true,
title: "Choose Sponsor",
visible: false,
width: "500px"
}).data("kendoWindow");

HIDDEN XSLT (this is contained in an XSL:OnClick attribute):

var window = $('#Sponsor').data('kendoWindow');window.center();window.open();

Realizing that using "window" as a variable could potentially be an issue, I changed it to look like this:

PARENT:

var kSponWin= $("#Sponsor");
if (!kSponWin.data("kendoWindow")) {
kSponWin.kendoWindow({
height: "100px",
modal: true,
title: "Choose Sponsor",
visible: false,
width: "500px"
}).data("kendoWindow");
}

HIDDEN:

kSponWin.center().open();

Nothin' doin'. The only difference is now my error says "kSponWin.kendoWindow" instead of "window.kendoWindow is not a function."

So does anyone have any idea as to what I should do? This problem is keeping me from testing.

Thanks in advance . . .

like image 949
Ray K. Avatar asked May 02 '26 11:05

Ray K.


1 Answers

I figured out my problem.

I went to Telerik's web site and found this: JavaScript error that Kendo widgets are unavailable or undefined.

So, I looked to see if there was more than one reference to jQuery. Sure enough, I found one. I removed it, and lo and behold, my code started working again.

like image 62
Ray K. Avatar answered May 04 '26 00:05

Ray K.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!