2014-01-30 3 views
0

안드로이드 응용 프로그램을 만들기 위해 sencha touch 2.3 및 PhoneGap을 사용하고 있습니다. 탐색보기에 문제가 있습니다.Sencha 탐색보기

main.js이 프로젝트에서

Ext.define('Myapp.view.Main',{ 
extend:'Ext.navigation.View', 
xtype:'mainvi, 
requires:['Myapp.view.RedirectView','Myapp.view.IncomingJobView','Myapp.view.MapView','Myapp.view.DriverLoginFormView','Myapp.view.DashboardView','Myapp.view.AccountView'], 
id:'navview', 
fullscreen:true, 
config:{ 
items:[{ 
    xtype:'RedirectView', 
}], 
navigationBar: { 
     items: [{ 
       xtype: 'button', 
       id:'logoutButtonId', 
       hidden:true, 
       text: 'Logout', 
       align: 'right', 
       handler: function(){} 
      }], 
     docked: 'top' 
     } 
    } 
}); 

방문 페이지는 만약 RedirectView 내가 다음 페이지지도보기이다 후 로그인 오전 한 번 할 때입니다.
다음 코드를 사용했습니다.

Ext.getCmp('navview').push({ 
xtype:'MapView' 
}); 

그 당시 로그 아웃 버튼을 클릭하면 "RedirectView"페이지로 리디렉션됩니다.
RedirectView 페이지를 가져온 후 다른 페이지를 사용할 수 없습니다.
콘솔에 다음 경고가 표시됩니다.
[WARN] [Ext.Component # constructor] 이미 사용 된 id ('driverLoginTextId')로 구성 요소 등록. 기존의 구성 요소가 파괴 된 확인하십시오 ('Ext.Component의 번호는()를 파괴하는'

을 다음은 내 RedirectView.js이 파일

Ext.define('Myapp.view.RedirectView', { 
extend : 'Ext.form.Panel', 
xtype : 'RedirectView', 
requires : ['Ext.Label'], 
config : { 
    styleHtmlContent : 'true', 
    scrollable : 'false', 
    //cls:'GreenBackgroundImage', 
    style : { 
     'background-image' : 'url(resources/images/background.jpg)', 
     'background-repeat' : 'no-repeat', 
     'background-size' : '100% 100%' 
    }, 
    //title: 'Register', 
    layout : { 
     type : 'vbox', 
     align : 'center', 
     pack : 'center' 
    }, 
    items : [{ 
      xtype : 'panel', 

      items : [{ 
        xtype : 'button', 
        id : 'RedirectAirportBtnId', 
        text : 'Airport Transfer', 
        width : '200px', 
        height : '35px', 
        style : { 
         'marginBottom' : '10px' 
        }, 
       }, { 
        xtype : 'button', 
        id : 'RedirectAsDirectedBtnId', 
        text : 'As Directed', 
        width : '200px', 
        height : '35px', 
        //style:{'marginBottom':'10px'}, 

       }, { 
        layout : 'hbox', 
        xtype : 'panel', 
        flex : 1, 
        items : [{ 
          xtype : 'panel', 
          id : 'signinLinkPanelId', 
          width : '100px', 
          items : [{ 
            layout : { 
             type : 'vbox', 
             align : 'center', 
             pack : 'center' 
            }, 
            items : [{ 
              xtype : 'label', 
              html : '<a href="#" style="font-size:17px;text-decoration:none;color:#2E3604;text-align:center" onclick=createLoginPage("passengerLoginTextId");><center>Sign in</center></a>', 
              styleHtmlContent : true 
             } 
            ] 
           } 
          ] 
         }, { 
          xtype : 'panel', 
          id : 'takeATourLinkPanelId', 
          flex : 1, 
          items : [{ 
            layout : { 
             type : 'vbox', 
             align : 'center', 
             pack : 'center' 
            }, 
            items : [{ 
              xtype : 'label', 
              html : '<a href="#" style="font-size:17px;text-decoration:none;color:#2E3604">Take a tour</a>', 
              styleHtmlContent : true 
             } 
            ] 

           } 
          ] 

         } 
        ] 
       }, { 
        layout : { 
         type : 'vbox', 
         align : 'center', 
         pack : 'center' 
        }, 
        items : [{ 

          xtype : 'label', 
          id : 'signinAsDriverLinkId', 
          html : '<a href="#" style="font-size:17px;text-decoration:none;color:#2E3604" onclick=createLoginPage("driverLoginTextId");>Login as driver</a>', 
          styleHtmlContent : true, 
          style : { 
           'marginTop' : '-20px' 
          } 
         }, { 
          xtype : 'label', 
          id : 'registerLinkId', 
          html : '<a href="#" style="font-size:17px;text-decoration:none;color:#2E3604" onclick=redirectToRegisterPage();>Register</a>', 
          styleHtmlContent : true, 
          style : { 
           'marginTop' : '-20px' 
          } 
         } 
        ] 
       } 
      ] 
     } 
    ] 

} 

}.);

페이지를 리디렉션하는 데 어떤 종류의 실수가 있습니까?
navigationView Array에서 이미 생성 된 구성 요소를 파괴하는 방법은 무엇입니까?

답변

0

먼저 밀어 발견되지 않는 경우는 다음 ID로 뷰를 생성 할 뷰를 얻으려고

var myMapView = Ext.getCmp('myMapView'); 
if(!myMapView){ 
    myMapView = Ext.create('Myapp.view.MapView', { id: "myMapView" }); 
} 

Ext.getCmp('navview').push(myMapView); 
관련 문제