简体   繁体   中英

How can I right-align the contents of a ExtJS tbar?

I have a tbar inside a grid panel like this:

在此输入图像描述

This is the code that produces it:

var grid = new Ext.grid.GridPanel({
    region: 'center',
    style: 'margin: 10px',
    store: new Ext.data.Store({
        data: myData,
        reader: myReader
    }),
    title: 'Testing',
    tbar: ['Filters:', {
            width:          100,
            xtype:          'combo',
            mode:           'local',
            value:          'en',
            triggerAction:  'all',
            forceSelection: true,
            editable:       false,
            fieldLabel:     'Produkt',
            name:           'language',
            hiddenName:     'language',
            displayField:   'name',
            valueField:     'value',
            store:          new Ext.data.JsonStore({
                fields : ['name', 'value'],
                data   : [
                    {name : 'German',   value: 'de'},
                    {name : 'English',  value: 'en'},
                    {name : 'French', value: 'fr'}
                ]
            })

        }],

What do I need to change so that the dropbox is right-aligned instead of left-aligned?

Addendum

thanks @dogbane, that works perfectly, here's how I right aligned both text and dropdown:

tbar: [
    {xtype: 'tbfill'},
    'Filters:',
    {
        width:          100,
        xtype:          'combo',
        mode:           'local',
        ...

Try:

{xtype: 'tbfill'}, // or '->'

See the docs for Ext.Toolbar.Fill .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM