2013-02-20 2 views
-1

는이의 ExtJS 4 - store.load

{ 
    xtype : 'button', 
    text : 'Prikazi', 
    handler : function(item,el){ 
     this.setDisabled(true); 
     store.load(function(records, operation, success) { 
      if(success){ this.up('button').setDisabled(false); } 
     }); 
    } 
} 

문제 같은 것을 할 날 HALP 수있을 때 버튼을 얻을 : this.up ('버튼')

답변

1

그냥 매개 변수를 사용을 당신 '전달 재 -

때문에'이 '버튼을 먼저 참조하여, 콜백에 상점을 의미한다 :

{ 
    xtype: 'button', 
    text: 'Refresh', 
    id:  'btn_refresh', 
    handler: function(clicked_button, the_event) { 

     clicked_button.setDisabled(true); 

     store.load(function(records, operation, success) { 
     if(success){ 
      clicked_button.setDisabled(false); 
     } 
     }); 

    } 
} 
01,

버튼의 상태를 제어하기 위해 저장소의 beforeload 이벤트를 사용하는 것이보다 효율적일 수 있습니다.

업데이트 : 예제를 더욱 분명하게 만들기 위해 변수 이름이 변경되었습니다.

아마

일단 FireBug 또는 Chrome Developer Tools를 체크 아웃 ... 그것은 도움이 있었어야 경우 답을 받아주십시오.

+0

그것의 작동 .. thx syslogic .. – dp15