14

如何在工具栏内拥有左、中、右三个区域?我知道我可以->用来触发所有以下项目的右对齐容器,但是中心呢?

4

4 回答 4

26

你可以用一个技巧来存档:

Ext.create('Ext.panel.Panel', {
     title: 'Toolbar Fill Example',
     width: 300,
     height: 200,
     tbar : [
         'Item 1',
         { xtype: 'tbfill' },
         'Item 4',
         { xtype: 'tbfill' },
         'Item 2'
     ],
     renderTo: Ext.getBody()
 });

JSFiddle

注意:

[
    'Item 1',
    '->',
    'Item 4',
    '->',
    'Item 2'
]

工作都一样。

它是如何工作的

->或者它的 xtypetbfill只不过是一个带有flex: 1配置的空组件。

于 2012-12-19T09:16:35.127 回答
5
Ext.create('Ext.panel.Panel', {
     title: 'Toolbar Fill Example',
     width: 300,
     height: 200,
     tbarCfg:{
          buttonAlign:'center'  //for center align
         // buttonAlign:'left' //for left align
         // buttonAlign:'right' //for right align
     },
     tbar : [
         'Item 1',
         { xtype: 'tbfill' },
         'Item 4',
         { xtype: 'tbfill' },
         'Item 2'
     ],
     renderTo: Ext.getBody()
 });
于 2012-12-19T13:26:02.840 回答
4
For Right:    
bbar: ['->',{
                    xtype: 'button',
                    text: 'xyz',

                }]

For Left:    
bbar: ['<-',{
                    xtype: 'button',
                    text: 'xyz',

                }]
于 2016-07-20T11:32:26.640 回答
2

dockedItems: [{ xtype: 'toolbar', buttonAlign:'center', dock: 'top', items: [{ text: '停靠到顶部' }] }]

于 2012-12-19T09:26:38.860 回答