Extending kendo window breaks kendoWindow

非 Y 不嫁゛ 提交于 2019-12-13 02:09:40

问题


I am attempting to subclass Kendo Window. So far my subclassed Window is working. However, it breaks the close event for standard Kendo Window. When the close event is called the follow error is thrown Uncaught TypeError: Cannot read property 'options' of undefined.

here is an example of what I'm trying to do. http://jsbin.com/IfoMOPU/6/edit?html,js,output

What am I missing to fix this?


回答1:


I believe this is a bug / design problem in Kendo UI. The only solution for now is to replace the kendoWindow widget and update the "windowObject" function so it also returns your window subclasses:

function windowObject(element, name) {
    var contentElement = element.children(KWINDOWCONTENT);

    return contentElement.data("kendoWindow") || contentElement.data("kendoMyWindow") || contentElement.data("kendo" + name);
}

Fixed example: http://jsbin.com/OfIHOm/1/edit

Update: As of Q2 2013 SP1 (version 2013.2.918), the code in the private function windowObject has been moved to the method _object.

This means that you can subclass kendoWindow like any other widget, however you'll still need to update kendoWindow's _object method:

/**
* update kendoWindow's _object method to return our new widget as well
*/
ui.Window.fn._object = function (element) {
    var content = element.children(KWINDOWCONTENT);

    return content.data("kendoWindow") || content.data("kendoMyWindow") || content.data("kendo" + this.options.name);
};

Updated example at http://jsfiddle.net/lhoeppner/qj2HL/




回答2:


I ran into this issue because My kendo window was loading a dynamic script in it's content. By moving this script into the header it resolved the issue



来源:https://stackoverflow.com/questions/19097360/extending-kendo-window-breaks-kendowindow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!