【问题标题】:How to align header items to the right in ExtJs如何在 ExtJs 中将标题项向右对齐
【发布时间】:2014-02-05 13:56:25
【问题描述】:

这是我的标题和它的项目;如您所见,我尝试添加 style 属性,但无济于事 - 链接仍左对齐,而我希望它右对齐:

items: [
{
    region: 'north',
    xtype: 'header',
    items:[
        {
            xtype: 'component',
            autoEl: {
                html: '<a href="#">View All Services</a>'
            },
            style: {
                textAlign: 'right',
                left: 'auto',
                right: '0'
            },
            listeners: {
                render: function(component) {
                    component.getEl().on('click', function(e) {
                        alert('test');
                    });
                }
            }
        }
    ],
    padding: 6
}

如何将我的项目与标题中的右侧对齐?

【问题讨论】:

    标签: javascript extjs


    【解决方案1】:

    将标头titlePosition 配置属性设置为0。默认情况下,标题组件中的项目添加在 标题标题之前。如果您将titlePosition config 设置为0,项目将添加到 title:

    items: [
    {
        region: 'north',
        xtype: 'header',
        titlePosition: 0,
        items:[
            {
                xtype: 'component',
                autoEl: {
                    html: '<a href="#">View All Services</a>'
                },
                listeners: {
                    render: function(component) {
                        component.getEl().on('click', function(e) {
                            alert('test');
                        });
                    }
                }
            }
        ],
        padding: 6
    }
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-05-05
    • 2016-09-04
    • 2011-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-01
    相关资源
    最近更新 更多