2012-01-06 113 views
4

我试图在TabPanel中的选项卡内显示列表。当我刚刚显示列表时 - 它工作正常,但是当我将它放在TabPanel中时,它不显示。Sencha touch 2 - 无法在面板或TabPanel中嵌套列表

当我在启动仪式上使用此代码结果表明:

Ext.create('Ext.List', { 
      fullscreen: true, 
      itemTpl: '<div class="contact">{ID} <strong>{Name}</strong></div>', 
      store: cityStore 
     }); 

当我使用此代码,它不会显示(尽管标签显示为需要)。我也尝试在项目中包含Ext.create列表,但结果仍然相同。

 Ext.create('Ext.TabPanel',{ 
      fullscreen: true, 
      tabBarPosition: 'bottom', 
      scrollable: true, 
      items: [ 
       { 
        title: 'Home', 
        iconCls: 'home', 
        html: ['Welcome to my Pizza!'].join(""), 
        style: 'text-align: center;' 
       }, 
       { 
        title: 'Search', 
        iconCls: 'search', 
        items: [ 
          Ext.create('Ext.List', { 
           fullscreen: true, 
           itemTpl: '<div class="contact">{ID} <strong>{Name}</strong></div>', 
           store: cityStore 
          }) 
        ] 
       }, 
       { 
        xtype: 'toolbar', 
        title: 'Pizza', 
        dock: 'top' 
       } 
      ] 
     }).setActiveItem(1); // this is set for debugging only 

什么可能是错的?谢谢!

回答

5

问题就解决了上煎茶论坛:

您面板嵌套在列表中。尝试UNNEST它:

代码:

Ext.create('Ext.tab.Panel',{ 
    fullscreen: true, 
    tabBarPosition: 'bottom', 
    scrollable: true, 
    items: [ 
     { 
      title: 'Home', 
      iconCls: 'home', 
      html: ['Welcome to my Pizza!'].join(""), 
      style: 'text-align: center;' 
     }, 
     { 
      xtype: 'list', 
      title: 'Search', 
      iconCls: 'search', 
      store: cityStore, 
      itemTpl: '<div class="contact">{ID} <strong>{Name}</strong></div>' 
     }, 
     { 
      xtype: 'toolbar', 
      title: 'Pizza', 
      dock: 'top' 
     } 
    ] 
}).setActiveItem(1); 
+1

能否请您解释一下 '不公开' 吗?我也试图完成这一点。 – 2013-04-18 03:38:14

+0

你必须把这个列表当作是一个标签本身。 – Carlos 2013-11-09 11:31:07