javascript - How to reduce the padding of the labels in an ExtJS FormPanel? - Stack Overflow

I'm trying to reduce the padding between the fields of my ExtJS form.I am able to change the style

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:

//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: 'pany',
            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.?

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:

//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: 'pany',
            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.?

Share Improve this question edited Apr 27, 2011 at 11:18 Edward Tanguay asked Apr 27, 2011 at 10:23 Edward TanguayEdward Tanguay 193k320 gold badges725 silver badges1.1k bronze badges 1
  • Oh please... don't post code samples as images. – Rene Saarsoo Commented Apr 27, 2011 at 11:14
Add a ment  | 

2 Answers 2

Reset to default 2

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

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742287361a4415562.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信