当我在sencha touch中从另一个视图点击后退按钮时,没有导航到叶节点

Not navigating to the leaf node when I Tap on the back button from another view in sencha touch

本文关键字:按钮 叶节点 导航 touch sencha 视图 另一个      更新时间:2023-09-26

我在我的应用程序中有一个嵌套列表,在叶子节点上我有一个地图按钮,我将MapView链接到这个按钮,它在MapView中运行得很好,现在当我点击MapView的返回按钮时,我得到一个空视图,而不是叶子节点,有以下警告

警告][Ext。注册一个已经被使用过的id为(mainlist)的组件。请确保现有组件已被销毁

[警告][Ext。用id (' detailcard ')注册一个已经被使用过的组件。请确保现有组件已被销毁(' Ext.Component#destroy() ')。

[警告][Ext。用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。查询('#[ITEMID OF YOUR COMPONENT]');

要深入了解ComponentQuery,请点击链接:

http://docs.sencha.com/touch/2.2.0/# !/api/Ext.ComponentQuery

的例子:

您有一个包含itemIdid的容器/项目。像这样,

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一起使用。

希望这对你有帮助!