2010-11-08 64 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導航是 工作得很好,沒有任何錯誤拋出到控制檯,所以再次嘗試,同時觀察你的 控制檯,我認爲有一個問題

相關問題