如何为ExtJS面板中的项目提供填充/边距

Mic*_* DN 4 extjs panel margins padding

我在用 ExtJS 2.3.0

我有一个面板和一些项目

{
    xtype: 'panel',
    border: false,
    margin: '10px;' // Not working for me
    items: [
            { boxLabel: 'One', xtype: 'checkbox' },
            { boxLabel: 'Two', xtype: 'checkbox' }
    ]
}
Run Code Online (Sandbox Code Playgroud)

我尝试使用保证金,填充......没有一个对我有用..

任何解决方案

mat*_*att 11

您可以使用bodyStyle配置属性:

{
    xtype: 'panel',
    border: false,
    bodyStyle: 'margin: 10px;'
    items: [
        { boxLabel: 'One', xtype: 'checkbox' },
        { boxLabel: 'Two', xtype: 'checkbox' }
    ]
}
Run Code Online (Sandbox Code Playgroud)


Vin*_*ala 6

ExtJS的2.3,有一个配置选项不支持"的margin,padding"Ext.Panel.

请查看文档http://docs.sencha.com/extjs/2.3.0/#!/api/Ext.Panel

你应该去bodyStyle配置选项.

{
     xtype: 'panel',
     border: false,
     bodyStyle: 'margin: 10px; padding: 5px 3px;',
     items: [
          { boxLabel: 'One', xtype: 'checkbox' },
          { boxLabel: 'Two', xtype: 'checkbox' }
     ]
}
Run Code Online (Sandbox Code Playgroud)

希望这对你有所帮助.....