如何使用extJs为字段集中的列中的项设置浮动左配置?
我正在尝试将字段集中列的内容左对齐。代码如下:如何使用extJs为字段集中的列中的项设置浮动左配置?,extjs,css-float,fieldset,Extjs,Css Float,Fieldset,我正在尝试将字段集中列的内容左对齐。代码如下: items: [{ xtype: 'fieldset', title: 'Level 1000', layout: 'column', width: '100%', items: [{ xtype: 'fieldcontainer', width: '50%',
items: [{
xtype: 'fieldset',
title: 'Level 1000',
layout: 'column',
width: '100%',
items: [{
xtype: 'fieldcontainer',
width: '50%',
items: [{
labelWidth: 'auto',
xtype: 'checkbox',
fieldLabel: 'State institutions',
name: 'IsTreasuryDepartments'
}, {
labelWidth: 'auto',
xtype: 'checkbox',
fieldLabel: 'Autonomous Institutions',
name: 'IsAutonomousDepartmenys'
}, {
labelWidth: 'auto',
xtype: 'checkbox',
fieldLabel: 'Other legal entity',
name: 'IsOtherJuridicalPerson'
}, ]
}, {
xtype: 'fieldcontainer',
width: '50%',
items: [{
labelWidth: 'auto',
xtype: 'checkbox',
fieldLabel: 'Budgetary institutions',
name: 'IsBudgetDepartments'
}, {
labelWidth: 'auto',
xtype: 'checkbox',
fieldLabel: 'Unitary enterprise',
name: 'IsUnitaryEnterprise'
}]
}]
}
结果:
我曾尝试对每个项目使用labelAlign:“right”或labelStyle:“float:right”,但它不起作用。如何为列中的标签和复选框设置float:right并接收以下内容
您需要使用数字值定义宽度或labelWidth
例如:
{
xtype:fieldset,
标题:1000级,
布局:列,
宽度:100%,
项目:[{
xtype:fieldcontainer,
宽度:50%,
默认值:{
宽度:300
},
项目:[{
标签宽度:自动,
xtype:复选框,
fieldLabel:国家机构,
名称:IstreasuredDepartments
}, {
标签宽度:自动,
xtype:复选框,
fieldLabel:自治机构,
名称:ISAutonomousDepartmentys
}, {
标签宽度:自动,
xtype:复选框,
fieldLabel:其他法人实体,
姓名:平等法人
}, ]
}, {
xtype:fieldcontainer,
宽度:50%,
默认值:{
宽度:300
},
项目:[{
标签宽度:130,
xtype:复选框,
字段标签:预算机构,
名称:IsBudgetDepartments
}, {
标签宽度:130,
xtype:复选框,
fieldLabel:单一企业,
名称:IsUnitaryEnterprise
}]
}]
}
在我的案例中,的示例工作如下:
items: [{
xtype: 'fieldset',
title: 'Level 1000',
layout: 'column',
width: '100%',
items: [{
xtype: 'checkboxgroup',
layout: 'vbox',
width: '50%',
layout: 'vbox',
defaults: {
labelAlign: 'right',
labelWidth: 170
},
items: [{
xtype: 'checkbox',
fieldLabel: 'State institutions',
name: 'IsTreasuryDepartments'
}, {
xtype: 'checkbox',
fieldLabel: 'Autonomous Institutions',
name: 'IsAutonomousDepartmenys'
}, {
xtype: 'checkbox',
fieldLabel: 'Other legal entity',
name: 'IsOtherJuridicalPerson'
}, ]
}, {
xtype: 'checkboxgroup',
layout: 'vbox',
width: '50%',
defaults: {
labelAlign: 'right',
labelWidth: 170
},
items: [{
xtype: 'checkbox',
fieldLabel: 'Other legal entity sdfsd',
name: 'IsBudgetDepartments'
}, {
xtype: 'checkbox',
fieldLabel: 'Unitary enterprise',
name: 'IsUnitaryEnterprise'
}]
}]
}]
是的,它是有效的,但在我的情况下,所需的解决方案有点不同。谢谢