2012-05-11 2 views
1

Sencha Touch 2 컨트롤러에서 itemId를 사용하여 컨테이너의 하위 항목을 참조하는 방법은 무엇입니까? 예를 들어, xtype이 'mypanel'인 컨테이너에는 itemId 'mybutton'이 포함 된 버튼이 있습니다. 컨트롤러에서 단추에 짝수 처리기를 할당하고 싶습니다. 어떻게해야합니까?컨트롤러에서 컨테이너의 하위 항목 참조

내 응용 프로그램은 꽤 커서 하나의 구성 요소가 중복되는 경우가 많으므로 내 응용 프로그램에서 id를 사용하지 않고 itemId를 사용합니다. 여기에 해당 ComponentQuery에 대한

Ext.define('myapp.controller.Test', { 
    extend: 'Ext.app.Controller', 

    config: { 
     control: { 
      myButton: { 
       tap: 'showView' 
      } 
     }, 
     refs: { 
      myPanel: 'mypanel', 
      myButton: '?' 
     } 
    }, 

    showView: function(){ 

    } 
}); 

답변

0

하는 해당 itemId 대신 ID의를 사용하여, 당신은 또한 컨트롤러의에서 항목 ID를 가진 요소를 포함하는 부모를 언급 할 필요가 이 같은 ref :

refs: { 
    mybutton: 'xtype_of_panel #itemId_button' 
    //where 'itemId_button' is the itemId and 'xtype_of_panel' is the parent that contains the element with the itemId of 'itemId_button' 
} 
관련 문제