문제

그래서 나는 SNAG에 빠지게됩니다. 분명히 get_events 메소드는 ExtenderControl 클래스와 "포함 된"것입니다.

내가해야 할 일:

이 시점에서 ExtenderControl을 사용하는 것이 실제로는 불가능하기 때문에 스크립트 콘트롤을 사용하여 get_events javaScript 메소드를 호출 할 수 있습니다.

스크립트 컨트롤의 JavaScript 객체가 무언가에서 상속되는 쉬운 방법이 있기를 바랍니다 (가능하다면).

도움이 되었습니까?

해결책

get_events 메소드는 실제로 작성하기가 간단합니다. 사전, 몇 줄의 코드 및 필요한 경우 이벤트를 호출 할 수있는 필드 만 있으면됩니다.

getEvents: function() 
{
    if (this._events == null) 
    {
        this._events = new Sys.EventHandlerList();
    }

    return this._events;
},

그리고 이제 액세스를 위해 :

onItemSelected: function(args)
{
   this.raiseEvent('userItemSelected', args);
},

raiseEvent: function(eventName, eventArgs)
{
    var handler = this.getEvents().getHandler(eventName);
    if(handler)
    {
        handler(this._autoComplete, eventArgs);
    }

},

기본적으로 이벤트는 이벤트의 이름과 호출 방법에 대한 참조를 보유한 사전 일뿐입니다. 메소드 (핸들러)가 있으면 전화하는 문제 일뿐입니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top