简体   繁体   English

使用extjs将组合框放置在文本字段旁边

[英]Combo box placed next to the textfield using extjs

My code: 我的代码:

var mpanel = new Ext.Panel({
        baseCls: 'x-plain',
        //layout: 'anchor',
        width: 290,
        height: 500,
        items: [{
            {
                width: 140,
                border: 1,
                readOnly: true,
                value: "combovalue",
                style: {
                    borderColor: 'black',
                    borderStyle: 'solid',
                    float: 'left'
                },
                xtype: 'textfield',

            }, {

                name: 'comp',
                id: 'compId',
                bodyStyle: 'margin-left:140px'
                triggerAction: 'all',

                mode: 'local',
                store: new Ext.data.SimpleStore({

                    fields: [
                        'myId',
                        'displayText'
                    ],
                    data: [
                        [1, 'item1'],
                        [2, 'item2']
                    ]
                }),

                displayField: 'displayText',
                xtype: 'combo',

            }]
        })

here I want textfield of width 140px and next to it I want to place combobox so i have included css margin-left:140px but style is not getting appended. 在这里,我想要宽度为140px的文本字段,并在其旁边放置组合框,因此我添加了css margin-left:140px,但样式未附加。

How to resolve this? 如何解决呢?

Wrap both fields in a HBox layout , place the textfield left (first item), and the combo right (second item). 将两个字段都包装在HBox布局中 ,将文本字段左移(第一项),将组合框右移(第二项)。 Do not forget to remove all styling you have put in css or "style" config option. 不要忘记删除您在CSS或“样式”配置选项中添加的所有样式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM