扩展kendo窗口中断kendoWindow [英] Extending kendo window breaks kendoWindow
问题描述
我正在尝试将Kendo Window子类化.到目前为止,我的子类Window正在运行.但是,它会中断标准剑道窗口的关闭事件.调用close事件时,将引发Uncaught TypeError: Cannot read property 'options' of undefined
跟随错误.
这是我要执行的操作的示例. http://jsbin.com/IfoMOPU/6/edit?html,js,output
要解决此问题,我缺少什么?
我相信这是Kendo UI中的错误/设计问题. 现在唯一的解决方案是替换kendoWindow小部件并更新"windowObject"函数,以便它还返回您的窗口子类:
function windowObject(element, name) {
var contentElement = element.children(KWINDOWCONTENT);
return contentElement.data("kendoWindow") || contentElement.data("kendoMyWindow") || contentElement.data("kendo" + name);
}
固定示例: http://jsbin.com/OfIHOm/1/edit >
更新: 自2013年第二季度SP1(版本2013.2.918)起,私有函数windowObject中的代码已移至方法_object.
这意味着您可以像其他任何小部件一样将kendoWindow子类化,但是您仍然需要更新kendoWindow的_object方法:
/**
* 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);
};
在 http://jsfiddle.net/lhoeppner/qj2HL/
上的更新示例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?
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/
这篇关于扩展kendo窗口中断kendoWindow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!