Sencha Touch:在嵌套列表中隐藏工具栏按钮?

mad*_*esh 1 extjs nested-lists sencha-touch sencha-touch-2

完整代码在这里

我有以下Sencha App嵌套列表,其中包含一个工具栏按钮.

在此输入图像描述

每当我点击任何列表项时,我都需要删除下面列表中显示"Tab Bar"的Button.如您所见,按钮仍然存在,我需要删除.

在此输入图像描述

继承我的观看代码

Sencha查看文件夹

Main.js

Ext.define('firstApp.view.Main', {
extend : 'Ext.Container',
xtype : 'main',
requires: [
              'Ext.TitleBar',
              'Ext.Button',
              'firstApp.model.item',
              'firstApp.store.nList',
              'Ext.dataview.NestedList',
              'Ext.data.TreeStore'
              //'Ext.ToolBar'
              ] ,
config : {
    fullscreen : true,
    layout : 'fit',
    items : [{
        xtype : 'nestedlist',
        title: 'List View',
        displayField : 'text',
        store : 'nList',
        //toolbar:{
        toolbar:{
            items :[
                             {
                               xtype : 'spacer'
                              },
                             {
                               xtype : "button",
                               text : 'Tab View',
                               align: 'right',
                               ui : "action",
                               handler: function(){                    
                                          Ext.Viewport.animateActiveItem((
                                          Ext.create('firstApp.view.view2')),
                                          {type: 'slide', direction:'left'}).show();
                                                   }
                             }
                      ]
                   }
                }
           ]
     }
});
Run Code Online (Sandbox Code Playgroud)

我该怎么办呢?请帮助我

1Ma*_*yur 7

http://www.senchafiddle.com/#33NZD

在这里你去帕尔..

我做了什么

  1. 为您分配了一个ID"标签视图按钮"
  2. 为您嵌套列表添加了2个侦听器
  3. itemtap将按ID获取按钮并隐藏它
  4. 返回将按ID获取按钮并显示它

这是代码

给我ID按钮

xtype : "button",
                        id: "btnTabView",
                        text : 'Tab View',
                        align: 'right',
                        ui : "action",
                        handler: function(){                    
                            Ext.Viewport.animateActiveItem((
                                Ext.create('firstApp.view.view2')),
                                                           {type: 'slide', direction:'left'}).show();
                        }  
Run Code Online (Sandbox Code Playgroud)

监听器嵌套列表

displayField : 'text',
store : 'nList',
listeners: {
    back: function( nList, node, lastActiveList, detailCardActive, eOpts ){
        if(node.getDepth() == 1){
            Ext.getCmp('btnTabView').show();
        }
    },
    itemtap: function( nList, list, index, target, record, e, eOpts ){
            Ext.getCmp('btnTabView').hide();
    }
},
Run Code Online (Sandbox Code Playgroud)