2011-11-25 67 views
0

我想將一個面板放在列表下面,但它似乎總是在列表頂部。我不想在列表上設置高度,因爲它可能沒有記錄或20,因此高度不同。顯示面板下面的列表sencha touch

我只想讓我的面板顯示在我的清單的正下方。另請注意,我禁用了滾動功能。

Rad.views.testList = Ext.extend(Ext.List, { 
     fullscreen: true, 
     layout: 'hbox', 
     scroll: false, 
     align: 'top', 

     store: Rad.stores.test, 

     itemTpl: Rad.views.testTemplate(), 


    }); 


    topPanel = new Ext.Panel({ 
     fullscreen: true, 
     scroll: true, 
     layout: { 
      type: 'vbox', 
      pack: "start", 
      align: "start" 
     }, 
     defaults: { 
      width: '100%', 
     }, 
     items: [ 
      { 
       layout: 'hbox', 
       items: [testList] 

      }, 
      { 
       html: 'This will be on the list not below!' 
     ] 


    }); 

    Ext.apply(this, { 
     layout: { 
      type: 'vbox', 
      pack : 'top', 
     }, 
     dockedItems: [titlebar], 
     items : [ topPanel] 
    }); 

回答

0

我應該一直在數據視圖中使用面板。

var tpl = new Ext.XTemplate(
    '<tpl for=".">', 
     '<div class="photosLocation">{pic}{name}', 
     '</div>', 
    '</tpl>' 
); 

var panel = new Ext.Panel({ 
    width:535, 
    autoHeight:true, 
    layout:'hbox', 
    title:'Simple DataView', 

    listeners: { 
     click: { 
      element: 'el', //bind to the underlying el property on the panel 
      fn: function(){ alert('click'); } 
     } 
    }, 
    items: new Ext.DataView({ 
     store: Rad.stores.deals, 
     tpl: tpl, 
     autoHeight:true, 
     itemSelector:'div.photosLocation', 

    }) 
});