javascript 如何减少 ExtJS FormPanel 中标签的填充?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5802555/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to reduce the padding of the labels in an ExtJS FormPanel?
提问by Edward Tanguay
I'm trying to reduce the paddingbetween the fields of my ExtJS form.
我正在尝试减少ExtJS 表单字段之间的填充。
I am able to change the style of the field datawith the style tag in the Items collection like this:
我可以使用 Items 集合中的 style 标签更改字段数据的样式,如下所示:
//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.?
但是我如何访问标签的样式,例如 styleLabel 或 labelStyle 等?
采纳答案by wombleton
There's labelPad
which defaults to 5px apparently, and labelStyle
if you need more than that.
有labelPad
以明显5PX其默认值,labelStyle
如果你需要比这更多。
回答by Abdel Raoof
You can make use of the labelStyle
property available for form fields.
Here is an example:
您可以利用labelStyle
可用于表单域的属性。下面是一个例子:
items: [{
fieldLabel: 'Company',
name: 'company',
labelStyle: 'padding: 10px 10px;'
}]