0

저는 Sencha Touch 프레임 워크에서 작업 중이며 내 추가보기를 푸시하기위한 탐색 모음을 디자인하려고합니다. 그러나 cardlayout (예 : xtype: 'mycard') 또는 위젯 (예 : xtype: 'my')을 추가하고 싶습니다. 이미 정의 된 기존 뷰를 밀어 넣을 수있는 방법은 Ext.define('MyProject.view.my', {//some deination})입니다. 다음 코드를 시도했지만 탐색 모음에서 단추를 눌렀을 때 내 handler 함수를 호출 할 수 없습니다. handler 함수에서 작동하지 않으므로 어떤보기로도 push을 볼 수 없으며 view.push을 호출 할 수 없습니다. 보기를 가져와 탐색 항목으로 푸시하려면 어떻게해야합니까? push Navigation Sencha Touch

푸시에 대한 몇 가지보기를 코드를 시도 :

//create the navigation view and add it into the Ext.Viewport 
    var view = Ext.Viewport.add({ 
     xtype: 'navigationview', 

     //we only give it one item by default, which will be the only item in the 'stack' when it loads 
     items: [{ 
      //items can have titles 
      title: 'Navigation View', 
      padding: 10, 

      //inside this first item we are going to add a button 
      items: [{ 
       xtype: 'button', 
       text: 'Push another view!', 
       handler: function() { 
        //when someone taps this button, it will push another view into stack 
        view.push({ 
         //this one also has a title 
         title: 'Second View', 
         padding: 10, 

         //once again, this view has one button 
         items: [{ 
          xtype: 'button', 
          text: 'Pop this view!', 
          handler: function() { 
           //and when you press this button, it will pop the current view (this) out of the stack 
           view.pop(); 
          } 
         }] 
        }); 
       } 
      }] 
     }] 
    }); 

내 코드 : 다음 즉석에서보기를 만들 뷰의 항목 컬렉션에 추가 할

{ 
         xtype: 'button', 
         text: 'btn', 
         id: 'btn1', 
         scope: this, 
         handler: function(b, e) { 
    //here I want to push my view named as xtype: 'my' 
// my main viewport has the xtype: 'main' and alias: 'widget.mypanel' 
         } 
        } 
+0

'보기를 푸시'하는 것은 무엇을 의미합니까? 귀하의 질문은 나에게 이해가되지 않습니다. –

답변

0

시도합니다. 나는. 이벤트 처리기에서 추가하려고 시도하십시오.

var view = Ext.create('MyProject.view.my', {}); 
this.add([view]);