Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs 如何将搜索框设置为中心?_Extjs_Extjs4 - Fatal编程技术网

Extjs 如何将搜索框设置为中心?

Extjs 如何将搜索框设置为中心?,extjs,extjs4,Extjs,Extjs4,如何将搜索框/文本字段设置为工具栏的中心 这是我正在使用的代码 Ext.create('Ext.toolbar.Toolbar', { renderTo: document.body, width : 500, items: [ { text: 'Button1' }, '->', { xtype : 'textfield',

如何将搜索框/文本字段设置为工具栏的中心

这是我正在使用的代码

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

只需在textfield定义之后添加
'->'
{xtype:'tbfill'}

项目:[
{
文本:“按钮1”
},
'->',
{
xtype:'textfield',
名称:'field1',
emptyText:“输入搜索词”
},
'->',
'-',
{
文本:“按钮2”
}
]

Haha。。谢谢朋友:)