使用带有ext.forms.combobox的style属性

时间:2012-02-09 12:07:21

标签: javascript extjs combobox

正在开发一个应用程序,其界面主要是用EXT.JS编写的 我在使用ext.form.combo-box时遇到了麻烦...我正在尝试调整组合框的样式,但我不确定样式属性是否有效且我可以使用它,我试过但它不起作用对我来说,这是我的代码:

this.m_arriveByForm  = new Ext.form.ComboBox({
                id:             'trip-arrive-form',
                name:           'arriveBy',
                hiddenName:     'arriveBy',
        style:    {position:'relative', left:'12px'},   // style attribute i added
                fieldLabel:     this.locale.tripPlanner.labels.when,
                store:          this.m_arriveByStore,
                value:          this.m_arriveByStore.getAt(0).get('opt'),
                displayField:   'text',
                valueField:     'opt',
                anchor:         this.FIELD_ANCHOR,
                mode:           'local',
                triggerAction:  'all',

                editable:       false,
                allowBlank:     false,
                lazyRender:     false,
                typeAhead:      true,
                forceSelection: true,
                selectOnFocus:  true,

        });

当我只添加一个样式规则时,它会起作用,如果我添加了多个样式规则,那么它会停止工作,感觉像ayntax错误但是你可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

您是否尝试过使用基本CSS格式?

style: 'position: relative; left: 12px;'

而不是

style: { 
    position: 'relative',
    left: '12px'
}

只是我当天结束的想法。

您似乎想要调整ComboBox的位置,我会通过配置包含ComboBox的组件的layout来实现。但由于您只显示有关ComboBox的代码,我不知道该解决方案是否会对您有所帮助。