ExtJS组合框中的css样式
我的代码:ExtJS组合框中的css样式,css,extjs,Css,Extjs,我的代码: { border: 1, bodyStyle: 'margin:0 0 0 140px;', style: { borderColor: 'black', borderStyle: 'solid', //margin:'0 0 0 140' //margin-left: '140px' }, width: 140, name: 'comp', id:'compId', triggerAction: 'all', mode: 'local', store:
{
border: 1,
bodyStyle: 'margin:0 0 0 140px;',
style: {
borderColor: 'black',
borderStyle: 'solid', //margin:'0 0 0 140' //margin-left: '140px' }, width: 140, name: 'comp', id:'compId', triggerAction: 'all', mode: 'local', store: new Ext.data.SimpleStore({
fields: ['myId', 'displayText'],
data: [
[1, 'item1'],
[2, 'item2']
]
}), displayField: 'displayText', xtype: 'combo',
},
在ext js 2.3中,bodyStyle没有附加到组合框中。有人能建议如何解决这个问题吗
谢谢我想这可能是你需要的
{
xtype: 'combo'
style : 'margin-left: 140px; border: solid black 1px;',
name: 'comp',
id:'compId',
triggerAction: 'all',
mode: 'local',
store: new Ext.data.SimpleStore({
fields: ['myId', 'displayText'],
data: [
[1, 'item1'],
[2, 'item2']
]
}),
displayField: 'displayText',
valueField : 'myId'
}
注意:根据文档,没有bodyStyle配置选项-
我删除了宽度选项,就像删除了margin left style属性(也是140px)一样,我认为您可能会得到一些奇怪的外观。combo.js:
{xtype:'combobox', cls:'combo'}
combo.css:
.combo .x-boundlist-selected {
background: #757575;
background-image: -webkit-linear-gradient(top, #757575, #474747);
background-image: -moz-linear-gradient(top, #757575, #474747);
background-image: -ms-linear-gradient(top, #757575, #474747);
background-image: -o-linear-gradient(top, #757575, #474747);
background-image: linear-gradient(to bottom, #757575, #474747);
border: solid #4e4e4e 2px;
color: #ffffff;
text-decoration: none;
}
.combo .x-boundlist-item {
background: #757575;
background-image: -webkit-linear-gradient(top, #757575, #474747);
background-image: -moz-linear-gradient(top, #757575, #474747);
background-image: -ms-linear-gradient(top, #757575, #474747);
background-image: -o-linear-gradient(top, #757575, #474747);
background-image: linear-gradient(to bottom, #757575, #474747);
border: solid #4e4e4e 2px;
color: #ffffff;
text-decoration: none;
}
这是在2.3版本中使用bodyStyle atribute的代码之一 这可能对你有帮助
this.itemCombo= new Ext.form.ComboBox({
name : "combooo",
fieldLabel : "Status",
displayField : 'combo',
valueField : 'id',
mode : 'local',
triggerAction : 'all',
hiddenName : "comboo",
editable : false,
width : 100,
store : this.store,
value : "0"
});
this.frmPanel = new Ext.form.FormPanel({
bodyStyle : "padding:10px",
border : true,
autoScroll : true,
layout : "table",
layoutConfig : {
columns : 1,
style : "vertical-align:top"
},
items : [{
bodyStyle : "padding-right:10px",
xtype : "panel",
layout : "form",
border : false,
labelWidth : 110,
colspan : 2,
items : [this.item1,this.itemCombo]
}]
});
这对我的情况没有帮助。我有一个textfield并内联到它,我放置了这个组合框。我有{xtype:'textfield',value:'comboValue',width:140px}并使用上面的代码在它旁边放置了一个组合框,所以我想将边距样式应用到bodyStyle,而不是内部元素。bodyStyle将对整个组合框应用样式,style元素将对其内部元素(即文本)应用样式。您能否发布完整的代码,以便我能够准确地看到您试图通过字段布局实现的目标?这听起来像是你试图在一个组合框中放置一个texfield,就像你说的是将其内联放置一样,我认为你不能用extjs来做这件事。请检查这个。我已经用代码发布了我的问题