2011-01-25 4 views
6

는 간단한 코드는 아래 (내가 그렇게 hopse 적어도) 내 질문에 설명 Firebug 오류 :상속 jQuery를에서 UI 대화 및 전화 재정의 된 메서드

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

어떻게 "최고"방법이라고 부를 수 있습니까?

jQuery를 UI 버전 난 그냥 해결책을 찾은 것 같아요 1.8.8

답변

11

... $.ui.dialog.prototype._create.call(this);

전체 코드 : jqueryui를 들어

$.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. 
    } 
}); 
+6

이 1.9 배 당신이 간단하게 할 수 있습니다'이 ._super ('_ create'); 위의 해결책은 여전히 ​​유효합니다. – earcam

+2

흥미 롭습니다. '_create' 함수의'this._super()'도 마찬가지입니다. 아마 맛의 문제 일 것입니다. – Saulius

+1

사실, docs (http://api.jqueryui.com/jQuery.widget/#method-_super)에 따르면 _super에는 인수가 없습니다. 당신이있는 곳을 마술처럼 알 수 있습니다. – Grinn