Combo box placed next to the textfield using extjs

半世苍凉 提交于 2019-12-13 07:43:21

问题


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.

How to resolve this?


回答1:


Wrap both fields in a HBox layout, place the textfield left (first item), and the combo right (second item). Do not forget to remove all styling you have put in css or "style" config option.



来源:https://stackoverflow.com/questions/28409834/combo-box-placed-next-to-the-textfield-using-extjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!