6

I have a main panel with layout set to vbox. I want to add TWO separate lists to the panel. I want the two lists to appear vertically stacked, and as they overflow the bottom of the main panel, the panel should simply scroll.

However, lists appear to require to be set in a FIT layout, in order to display. Fit layouts do not permit vertically stacking of items.

Am I missing a feature of the layout system that allows me to tell the list to fully display itself inside a parent with a vbox layout?

4

3 回答 3

3

Ext.List组件的超类 isExt.DataView和 not Ext.Panel

因此,您需要在两个单独的面板中添加两个列表,并将这两个面板添加到一个超级面板中。
此外,您需要layout:'vbox'为超级面板制作并layout:'fit'为其他两个子面板制作

这是你如何做到的。

....
....
var superpanel = new Ext.Panel({
    fullscreen: true,
    layout: 'vbox',             // to vertically stack two list.
    items: [
        {
           xtype: 'panel',
           id: 'panel_1',
           width: '100%',
           layout: 'fit',
           items: [
                {
                   xtype: 'list',
                   flex:1,
                   id: 'list1',
                   store: 'samplestore1'
                }
           ]
         },
         {
            xtype: 'panel',
            id: 'panel_2',
            width: '100%',
            layout: 'fit',
            items: [
                 {
                  xtype: 'list',
                  id: 'list2',
                  flex:1,
                  store: 'samplestore2'
                 }
            ]
         }
    ]
 });
....
....
于 2012-04-30T05:25:49.087 回答
1
var parent = new Ext.Panel({
    fullscreen: true,
    layout: 'vbox',
    items: [
        {
           xtype: 'list',
           id: 'list_1',
           store: 'store1,
           flex: 1
         },
         {
          xtype: 'list',
           id: 'list_2',
           store: 'store2,
           flex: 1
         }
    ]
 });
于 2012-04-30T10:40:28.490 回答
0

将 height:'auto' 放在列表项上

items: [
    {
       xtype: 'list',
       height: 'auto'
     },
     {
      xtype: 'list',
       height: 'auto',
     }
]
于 2012-09-17T21:51:15.737 回答