简体   繁体   English

如何在ExtJs中将标题项对齐到右侧

[英]How to align header items to the right in ExtJs

This is my header with it's items; 这是我头上的物品; as you can see I tried adding a style property but it doesn't help - the link is still aligned to the left whereas I want it to align right: 你可以看到我尝试添加一个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
}

How can I align my items to the right in my header? 如何在标题中将我的项目对齐?

Set header titlePosition configuration property to 0 . 将标题titlePosition配置属性设置为0 By default items in header component are added before header title. 默认情况下,标题组件中的项目在标题标题之前添加。 If you set titlePosition config to 0 , items will be added after title: 如果将titlePosition配置设置为0 ,则会标题添加项目:

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
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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