2015-02-06 63 views
0

我的代码:CSS样式

{ 
    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不获取附加到combobox.Can任何建议如何解决这个问题?

谢谢

回答

0

我认为这可能是你需要的。

{ 
    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配置选项 - http://docs.sencha.com/extjs/2.3.0/#!/api/Ext.form.ComboBox

我删除宽度的选择,因为与保证金左style属性(也140px),我想你可能最终得到一些奇怪看着。

+0

这不是在我的情况帮忙。我有一个文本框,并内联到它即将放置此组合框。 – user2940383 2015-02-09 04:56:13

+0

我有{xtype:'textfield',value:“comboValue”,width:140px}并使用上面的代码在它旁边放置了一个combox框,所以我想将margin-style应用到bodyStyle而不是内部元素。 bodyStyle会将样式应用于整个组合框,样式元素将应用于其内部元素,即文本。 – user2940383 2015-02-09 05:04:15

+0

你可以发布你的整个代码,所以我可以确切地看到你正在试图实现你的领域的布局?这听起来像你试图把一个texfield放在一个组合框中,正如你所说的将它放在内联中,我不认为你可以用ExtJS – mindparse 2015-02-09 10:16:28

0

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; 
}