继承自jQuery UI对话框并调用重写方法 [英] Inherit from jQuery UI dialog and call overridden method

查看:148
本文介绍了继承自jQuery UI对话框并调用重写方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的简单代码描述了我的问题(至少我跳过这样):

The simple code below describes my question (at least I hopse so):

$.widget("ui.mydialog", $.ui.dialog, {
  _create: function() {
    // How to call _create method of dialog?
  }
});

我试图调用 $ .ui.dialog.prototype._create() 来自上面的create方法,但在Firebug中得到以下错误:

I tried to call $.ui.dialog.prototype._create() from within the above create method, but get the below error in Firebug:

this.element is undefined
this.originalTitle = this.element.attr('title');
jquery...5667348 (line 5864)

我怎么称呼超级 方法?

How else can I call that "super" method?

jQuery UI版本1.8.8

jQuery UI version 1.8.8

推荐答案

我我只是找到了一个解决方案... $。ui.dialog.prototype._create.call(this);

I guess I just found a solution ... $.ui.dialog.prototype._create.call(this);

完整代码:

$.widget("ui.ajaxdialog", $.ui.dialog, {
  _create: function() {
    // Your code before calling the overridden method.
    $.ui.dialog.prototype._create.call(this);
    // Your code after calling the overridden method.
  }
});

这篇关于继承自jQuery UI对话框并调用重写方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆