Widget Object Is Undefined after Loading a Page through AJAX
Environment
Product | Progress® Kendo UI® for jQuery |
Kendo Version | 2017.2.621 |
Description
The widget object is undefined after loading a page with AJAX.
Cause
This issue is usually caused when the page loaded via AJAX contains a script reference to jQuery. When jQuery is re-initialized, all jQuery-based data attributes are cleared, including the data
(kendoWidget
) attribute that holds the Kendo UI widget object.
Solution
Load a partial HTML fragment that does not contain any unneeded jQuery references, or use an iframe
to load the complete page.
The example below demonstrates a test issue.
$("#dialog").kendoWinodow({
// loads complete page
content: "/foo"
});
The example below demonstrates the solution of the test issue above.
$("#dialog").kendoWindow({
// load complete page...
content: "/foo",
// ... and show it in an iframe
iframe: true
});
// or
$("#dialog").kendoWinodow({
// load partial page, without jQuery reference
content: "/foo"
});