【问题标题】:How to move between panels in Sencha touch如何在 Sencha touch 中的面板之间移动
【发布时间】:2012-06-13 08:30:00
【问题描述】:

在面板之间移动时出现以下错误

[WARN][Ext.Component#constructor] Registering a component with a id (`logOutButton`) which has already been used. Please ensure the existing component has been destroyed (`Ext.Component#destroy()`. 

我可以返回上一个屏幕,但如果没有出现上述错误,就无法再次前进。

为了解决这个问题,我尝试使用下面的代码,但它不起作用。谁能帮帮我?

var loginView = Ext.getCmp('login');
    if(!loginView){
       Ext.getCmp('loginTest2').destroy(); 
      loginView = Ext.create('com.view.Login');
  }

  Ext.Viewport.setActiveItem('login');

我也试过了:

if(Ext.getCmp('login')){
     Ext.Viewport.setActiveItem('Login');
  }else{

    Ext.Viewport.setActiveItem(Ext.create('com.view.Login'));
  }

这些都不起作用并导致相同的错误和空白屏幕。我正在使用 Sencha Touch 2。

【问题讨论】:

    标签: touch extjs


    【解决方案1】:

    我们可以简单地使用以下行从一个面板导航到另一个面板..

    Ext.Viewport.animateActiveItem({ xtype: "cat" }, { type: "slide", direction: "up" });
    

    这里,xtype是我们可以为要显示的面板定义的,像这样……,

    Ext.define('BeLocal.view.LeftCurveList', {
           extend: 'Ext.Panel',
    
           **xtype: 'cat',**
    
           config: {
    
           items: [
                   {
                   xtype: 'toolbar',
                   docked: 'top',
                   width: '100%',
                   padding:0,
                   title: 'BeLocal Places',
                   items:[{
                          xtype: 'button',
                          ui: 'back',
                          text: 'Back',
                          ]
                   },
    
                ]
           }
           });
    

    【讨论】:

      【解决方案2】:

      为避免此错误,请勿将 id 用于按钮或任何其他项目,而不是 id 使用按钮操作配置或使用项目 id。使用 itemId 销毁组件只需使用此`

      Ext.ComponentQuery.query('list[action=diaryselectlist]')[0].destroy();
      

      在它上面只是破坏了我给他的行动而不是id的列表,你可以在这个..中给itemId而不是行动 希望你会喜欢这个

      【讨论】:

        猜你喜欢
        • 2013-03-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-05-04
        • 2013-01-25
        相关资源
        最近更新 更多