简体   繁体   English

在和Ext JS表单中,如何使某些字段宽度比其他字段宽?

[英]In and Ext JS form, how can I make some field widths wider than others?

In an Ext JS form, I can define the labelWidth in the form itself. 在Ext JS表单中,我可以在表单本身中定义labelWidth

But in this case, I want some labels (the headers) to have a wider width. 但是在这种情况下,我希望某些标签(标题)具有更宽的宽度。

However, even if I define them explicitly , they remain just as wide as the others: 然而,即使我将它们定义明确 ,他们仍然一样宽的人:

在此处输入图片说明

I can of course change all of them to a wider width, but that is also undesirable : 我当然可以将它们全部更改为更宽的宽度,但这也不可取

在此处输入图片说明

How can I define all fields to be 100 width yet the header fields to be 200? 如何定义所有字段的宽度为100,而标题字段的宽度为200?

here is the current code: 这是当前代码:

var form_left = new Ext.FormPanel({
    frame:true,
    labelWidth: 100,
    labelAlign: 'left',
    bodyStyle:'padding:10px',
    width: 300,
    height: 600,
    autoScroll: true,
    itemCls: 'form_row',
    defaultType: 'displayfield',
    items: [{
            fieldLabel: 'BASE PRODUCT',
            itemCls: 'form_row_header',
            labelSeparator: '',
            labelWidth: 200
        },{
            fieldLabel: 'Product',
            value: 'Brochure'
        },{
            fieldLabel: 'Format',
            value: 'DIN A4 portrait (201 x 297 cm)'
        },{
            fieldLabel: 'Amount',
            value: '50 sheets'
        },{
            fieldLabel: 'Product',
            value: 'Brochure'
        },{
            fieldLabel: 'Product',
            value: 'Brochure'
        },{
            fieldLabel: 'Product',
            value: 'Brochure'
        },{
            fieldLabel: 'ADDITIONAL OPTIONS',
            itemCls: 'form_row_header',
            labelSeparator: '',
            labelWidth: 200
        },{
            fieldLabel: 'Product',
            value: 'Brochure'
        },{
            fieldLabel: 'Format',
            value: 'DIN A4 portrait (201 x 297 cm)'
        },{
            fieldLabel: 'Amount',
            value: '50 sheets'
        }
    ]
});

I would use xtype: 'label' for your two headers rather than fieldLabel . 我会为您的两个标头而不是fieldLabel使用xtype: 'label' Change the fields to the following: 将字段更改为以下内容:

{
  xtype: 'label',
  text: 'BASE PRODUCT',
  cls: 'form_row_header'
} 

and

{
  xtype: 'label',
  text: 'ADDITIONAL OPTIONS',
  cls: 'form_row_header'
}

Take a look at the following jsFiddle for a complete example: 看下面的jsFiddle作为一个完整的例子:

http://jsfiddle.net/vMutF/ http://jsfiddle.net/vMutF/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM