How to give padding/margin to items inside the ExtJS panel
Asked Answered
B

3

6

I am using ExtJS 2.3.0

I have a panel and some items inside that

{
    xtype: 'panel',
    border: false,
    margin: '10px;' // Not working for me
    items: [
            { boxLabel: 'One', xtype: 'checkbox' },
            { boxLabel: 'Two', xtype: 'checkbox' }
    ]
}

I tried using margin, padding... none of them is working for me..

Any solutions.

Backstitch answered 22/1, 2014 at 7:39 Comment(0)
D
13

You could use the bodyStyle configuration property:

{
    xtype: 'panel',
    border: false,
    bodyStyle: 'margin: 10px;'
    items: [
        { boxLabel: 'One', xtype: 'checkbox' },
        { boxLabel: 'Two', xtype: 'checkbox' }
    ]
}
Dana answered 22/1, 2014 at 9:15 Comment(0)
J
8

In ExtJs 2.3, there is no support for config options "margin, padding" in Ext.Panel.

Check in the documentation http://docs.sencha.com/extjs/2.3.0/#!/api/Ext.Panel

you should go for bodyStyle config option.

{
     xtype: 'panel',
     border: false,
     bodyStyle: 'margin: 10px; padding: 5px 3px;',
     items: [
          { boxLabel: 'One', xtype: 'checkbox' },
          { boxLabel: 'Two', xtype: 'checkbox' }
     ]
}

Hope this helped you.....

Jewelljewelle answered 22/1, 2014 at 9:29 Comment(0)
L
1

Below should also work:

var myForm = new Ext.form.FormPanel ({
title: 'My Form',
width: 400,
height: 250,
padding: '50 10 10 10',
Lei answered 12/11, 2020 at 10:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.