EXTJS - HOW TO SET ITEMS MARGINS AND PADDINGS?

John Brown

Total Post:6

Points:42
Posted by  John Brown
 975  View(s)
Ratings:
Rate this:
I am new in ExtJS environment. My problem is how can I set magins and paddings in our form.
Below I have provided my code: I have created a panel with some items :
{
    xtype: 'panel',
    margin: '20px;' // this margin is not working for me
    items: [
         {
            boxLabel: 'First Check',
            xtype: 'checkbox'
         }, {
            boxLabel: 'Second Check',
            xtype: 'checkbox'
         }]
}
I tried using margins and padding but none of them is working for me.
Please provide me the solution. 
Thank you.
  1. Tarun Kumar

    Post:214

    Points:1642
    Re: Extjs - How to set items margins and paddings?

    You can set the margin and padding of the panel using the bodyStyle: property. In the bodyStyle property we can define both of them together. below I have provided an example on your code:

    {
        xtype: 'panel',
        bodyStyle: 'margin: 10px; padding: 10px 5px;',
        items: [
             {
                boxLabel: 'First Check',
                xtype: 'checkbox'
             }, {
                boxLabel: 'Second Check',
                xtype: 'checkbox'
             }]
    }
    I hope it will be helpful for you.

      Modified On May-13-2016 12:12:58 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!