2010-11-08 61 views
6

我还是Sencha Touch/ExtJS的新手,我正在探索演示和入门示例。但我偶然发现了这个问题,当我在选项卡面板项目上插入一个嵌套列表时,我无法再浏览列表项目。Sencha Touch:标签面板内的嵌套列表

这里是我的代码:

Ext.setup({ 
tabletStartupScreen: 'tablet_startup.png', 
phoneStartupScreen: 'phone_startup.png', 
icon: 'icon.png', 
glossOnIcon: false,   

onReady: function(){ 

    // store with data 
    var data = { 
     text: 'Groceries', 
     items: [{ 
      text: 'Drinks', 
      items: [{ 
       text: 'Water', 
       items: [{ 
        text: 'Sparkling', 
        leaf: true 
       },{ 
        text: 'Still', 
        leaf: true 
       }] 
      },{ 
       text: 'Coffee', 
       leaf: true 
      },{ 
       text: 'Espresso', 
       leaf: true 
      },{ 
       text: 'Redbull', 
       leaf: true 
      },{ 
       text: 'Coke', 
       leaf: true 
      },{ 
       text: 'Diet Coke', 
       leaf: true 
      }] 
     },{ 
      text: 'Fruit', 
      items: [{ 
       text: 'Bananas', 
       leaf: true 
      },{ 
       text: 'Lemon', 
       leaf: true 
      }] 
     },{ 
      text: 'Snacks', 
      items: [{ 
       text: 'Nuts', 
       leaf: true 
      },{ 
       text: 'Pretzels', 
       leaf: true 
      },{ 
       text: 'Wasabi Peas', 
       leaf: true 
      }] 
     },{ 
      text: 'Empty Category', 
      items: [] 
     }] 
    }; 
    Ext.regModel('ListItem', { 
     fields: [{name: 'text', type: 'string'}] 
    }); 
    var store = new Ext.data.TreeStore({ 
     model: 'ListItem', 
     root: data, 
     proxy: { 
      type: 'ajax', 
      reader: { 
       type: 'tree', 
       root: 'items' 
      } 
     } 
    }); 
    var nestedList = new Ext.NestedList({ 
     fullscreen: true, 
     title: 'Groceries', 
     displayField: 'text', 
     dock: 'top', 
     store: store 
    }); 

    var btnSpecTop = [ 
     { ui: 'back', text: 'Back'}, 
     { xtype: 'spacer' }, 
     { ui: 'default', text: 'Login' } 
    ] // end btnSpecTop 


    var tapHandler = function (btn, evt) { 
     alert("Button '" + btn.text + "' tapped."); 
    }   


    var dockedItems = [{ 
     xtype: 'toolbar', 
     dock: 'top', 
     title: 'Demo', 
     items: btnSpecTop, 
     defaults: { handler: tapHandler } 
     }, 
     { 
      xtype: 'tabpanel', 
      layout: 'card', 
      dock: 'top', 
      fullscreen: true, 
      items:[{ 
       title: 'test1', 
       html: '<p>test 1</p>' 
      }, 
      { 
       title: 'test2', 
       html: '<p>test 2</p>', 
       dockedItems: nestedList 
      }, 
      { 
       title: 'test3', 
       html: '<p>test 3</p>' 
      }] 
     }     
    ] 

    var appPanel = new Ext.Panel({ 
     id: 'appPanel', 
     fullscreen: true, 
     dockedItems: dockedItems    
    }); 

} // end onReady 
}); 

希望有人能够伸出援助之手。谢谢!

+0

voidnothings,你使用哪种版本的sencha touch?我只是试过你的代码,它对我来说工作正常(我使用的是v1.0)... – carok 2010-11-17 16:33:44

+0

对不起,后期更新。 sencha touch的RC版本解决了这个错误。谢谢Carok! – 2011-01-18 08:15:48

回答

3

此错误仅存在于Sencha Touch的预RC版本中。 :)

0

我不知道你使用的是哪个版本煎茶触摸,但是在sencha-touch-1.1.0导航是 工作得很好,没有任何错误抛出到控制台,所以再次尝试,同时观察你的 控制台,我认为有一个问题