2014-01-30 23 views
2

如何將搜索框/文本字段設置爲工具欄的中心?如何將搜索框設置爲中心?

這裏是我使用的代碼...

Ext.create('Ext.toolbar.Toolbar', { 
    renderTo: document.body, 
    width : 500, 
    items: [ 
     { 
      text: 'Button1' 
     }, 
     '->', 
     { 
      xtype : 'textfield', 
      name  : 'field1', 
      emptyText: 'Enter search term' 
     }, 
     '-', 
     { 
      text: 'Button2' 
     } 
    ] 
}); 

注:我使用的ExtJS 4.2.1

回答

2

只需添加'->'{ xtype: 'tbfill' }後也文本框定義:

items: [ 
    { 
     text: 'Button1' 
    }, 
    '->', 
    { 
     xtype : 'textfield', 
     name  : 'field1', 
     emptyText: 'Enter search term' 
    }, 
    '->', 
    '-', 
    { 
     text: 'Button2' 
    } 
] 
+0

哈哈..感謝朋友:) –

相關問題