Edward Tanguay
Edward Tanguay

Reputation: 193362

How to reduce the padding of the labels in an ExtJS FormPanel?

I'm trying to reduce the padding between the fields of my ExtJS form.

I am able to change the style of the field data with the style tag in the Items collection like this:

enter image description here

//form right
var simple_form_right = new Ext.FormPanel({
    frame:true,
    labelWidth: 90,
    labelAlign: 'right',
    title: 'Orderer Information',
    bodyStyle:'padding:5px 5px 0 0',
    width: 300,
    height: 600,
    autoScroll: true,
    itemCls: 'form_row',
    defaultType: 'displayfield',
    items: [{
            fieldLabel: 'Customer Type',
            name: 'customerType',
            style: 'padding:0px;font-size:7pt',
            labelStyle: 'padding:0px',
            allowBlank: false,
            value: 'Company'
        },{
            fieldLabel: 'Company',
            name: 'company',
            value: 'The Ordering Company Inc.'
        },{
            fieldLabel: 'Last Name',
            name: 'lastName',
            value: 'Smith'
        }, {
        ...

But how do I access the style of the label as well, something like styleLabel or labelStyle, etc.?

Upvotes: 3

Views: 12764

Answers (2)

Abdel Raoof Olakara
Abdel Raoof Olakara

Reputation: 19353

You can make use of the labelStyle property available for form fields. Here is an example:

items: [{
   fieldLabel: 'Company',
   name: 'company',
   labelStyle: 'padding: 10px 10px;'
}]

Upvotes: 1

wombleton
wombleton

Reputation: 8376

There's labelPad which defaults to 5px apparently, and labelStyle if you need more than that.

Upvotes: 2

Related Questions