[英]How to navigate to another view when i tapped a button in Sencha touch
[英]Not navigating to the leaf node when I Tap on the back button from another view in sencha touch
我的應用程序中有一個嵌套列表,在葉子節點上,我有一個地圖按鈕,我將MapView鏈接到此按鈕,它與MapView的關系很好,現在,當我點擊MapView的后退按鈕時,我得到一個空白視圖,而不是具有以下警告的葉節點
WARN] [Ext.Component#constructor]用ID( mainlist
)注冊一個已經使用過的組件。 請確保現有組件已被銷毀
[WARN] [Ext.Component#constructor]用已經使用過的id(`detailcard`)注冊一個組件。 請確保現有組件已被銷毀(`Ext.Component#destroy()`。
[WARN] [Ext.Component#constructor]用已經使用過的id(“ description”)注冊一個組件。 請確保現有組件已被銷毀(`Ext.Component#destroy()`。
我的地圖按鈕
onDetailButtonTap:function(activeItem){
var record = this;
Ext.Viewport.animateActiveItem((
Ext.create('App.view.MapView')),
{
type: 'slide',
direction:'left',
}).show();
},
我的地圖視圖
handler: function(){
//var x=document.getElementById("textt");
//alert(x.innerHTML);
Ext.Viewport.animateActiveItem((
Ext.create('App.view.Sections')),
{
type: 'slide',
direction:'left',
}).show();
}
我需要一些認真的幫助
此問題的常見解決方法是使用itemId
而不是使用id
來查詢組件。 使用itemId
,可以使用Ext.ComponentQuery.query進行所有查詢。
Ext.getCmp('[組件的ID]');
(相當於)
Ext.ComponentQuery.query('#[您組件的ITEMID]');
要進一步研究ComponentQuery,請點擊以下鏈接:
http://docs.sencha.com/touch/2.2.0/#!/api/Ext.ComponentQuery
例:
您有一個帶有itemId
和id
的容器/物品。 像這樣,
items: [
{
xtype: 'titlebar',
docked: 'top',
id: 'titleBar',
itemId: 'barTitle',
title: 'fooBar'
},
因此,如果您只想使用id更改標題,則可以執行以下操作:
Ext.getCmp('titleBar').setTitle('Title Changed using ID');
//'titleBar'是ID
您也可以使用itemId
進行此操作。 為此,您可以編寫如下代碼:
Ext.ComponentQuery.query('#barTitle')[0].setTitle('Title Changed using ItemId');
//'barTitle'是ItemId
以上兩種方法可以完成相同的工作。 因此,根據您的情況,您可以使用第二種方法來解決問題。 換句話說,您可以將Ext.ComponentQuery.query
函數與itemId
。
希望這可以幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.