想要表格布局中的单元格填充

时间:2014-09-12 09:57:01

标签: extjs extjs4

我想在我的组件之间添加一些填充。目前我的表格如下:

enter image description here

如果我想在所有组件之间有5个像素间距,那么有一种简单的方法吗?如果我在面板级别添加margin和padding值,那么这只会影响面板本身,而不是它包含的元素:

margin: '5 5 5 5',
padding: '15',
xtype:'panel',
layout: {
    type: 'table',
    columns: 3
},
items: [
    {
        xtype:'label',
        text:'Name *'
    },{
        xtype:'label',
        text:'Version *'

    }, {
        xtype:'label',
        text:'Sprache *'
    }, {

        xtype:'textfield',
        text:'Name *'

    }, {
        xtype: 'textfield',
        text: 'Version *'
    }, {
        xtype: 'combobox',
        text: 'Sprache *'
    }
]

我可以为每个组件添加填充,但这看起来很痛苦。

1 个答案:

答案 0 :(得分:2)

啊,只是用一些摩尔谷歌搜索出来。您需要在布局的tdAttrs值上设置样式填充。

                    layout: {
                        type: 'table',
                        columns: 3,
                        tdAttrs: { style: 'padding: 10px;' }
//                        padding: '65'
                    },

任何人都知道更好的解决方案吗?