问题描述
我的应用程序中有一个嵌套列表,在叶节点上我有一个地图按钮,我将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.getElement ById( 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 OF THE COMPONENT]');
(相当于) / p>
Ext.ComponentQuery.query('#[ITEMID OF YOUR COMPONENT]');
进一步挖掘在ComponentQuery上,请点击链接:
示例:
您有一个容器/项目,其中包含 itemId
和 id
。像这样,
items:[
{
xtype:'titlebar',
docked :'top',
id:'titleBar',
itemId:'barTitle',
title:'fooBar'
},
所以,如果你只是想使用id更改标题,你可以这样做:
Ext.getCmp('titleBar')。setTitle('标题改为使用ID');
//'titleBar'是ID
您也可以使用 itemId
这样做。为此,您可以编写一行代码:
Ext.ComponentQuery.query('#barTitle')[0 ] .setTitle('标题改为使用ItemId');
//'barTitle'是ItemId
Ext.ComponentQuery.query 函数与
itemId
。 希望这有帮助!
I have a nested list in my app, on the leaf node i have a map button, I linked my MapView to this button, its going well to the MapView, Now when I tap on the back button of the MapView I am getting a empty view instead of the leaf node with the following warnings
WARN][Ext.Component#constructor] Registering a component with a id (mainlist
) which has already been used. Please ensure the existing component has been destroyed
[WARN][Ext.Component#constructor] Registering a component with a id (`detailcard`) which has already been used. Please ensure the existing component has been destroyed (`Ext.Component#destroy()`.
[WARN][Ext.Component#constructor] Registering a component with a id (`description`) which has already been used. Please ensure the existing component has been destroyed (`Ext.Component#destroy()`.
My Map Button
onDetailButtonTap: function(activeItem) {
var record = this;
Ext.Viewport.animateActiveItem((
Ext.create('App.view.MapView')),
{
type: 'slide',
direction:'left',
}).show();
},
My Map View
handler: function(){
//var x=document.getElementById("textt");
//alert(x.innerHTML);
Ext.Viewport.animateActiveItem((
Ext.create('App.view.Sections')),
{
type: 'slide',
direction:'left',
}).show();
}
I need some serious help
A common workaround for this issue is to use itemId
instead of using id
to query a component. With itemId
, you can use Ext.ComponentQuery.query to make all queries.
Ext.getCmp('[ID OF THE COMPONENT]');
(Is equivalent to)
Ext.ComponentQuery.query('#[ITEMID OF YOUR COMPONENT]');
To dig in further on ComponentQuery, please follow the link:
http://docs.sencha.com/touch/2.2.0/#!/api/Ext.ComponentQuery
Example:
You have a container/item with an itemId
and an id
. Like this,
items: [
{
xtype: 'titlebar',
docked: 'top',
id: 'titleBar',
itemId: 'barTitle',
title: 'fooBar'
},
So, if you just want to change the title using id, you will do this:
Ext.getCmp('titleBar').setTitle('Title Changed using ID');
// 'titleBar' is the ID
You can do this same using itemId
too. For that, you can write a line of code like this:
Ext.ComponentQuery.query('#barTitle')[0].setTitle('Title Changed using ItemId');
// 'barTitle' is the ItemId
The above two ways do the same job. So, in your case, you can use the second way to fix the problem. In other words, you can use Ext.ComponentQuery.query
function with itemId
.
Hope this helps!
这篇关于当我从sencha触摸中的另一个视图中点击后退按钮时,不导航到叶节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!