javascript EXTJS 组合框多选

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11229580/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 12:28:00  来源:igfitidea点击:

EXTJS comboBox multiselect

javascriptextjsextjs3

提问by user595234

In the ExtJS 3.3.1, I tried to make comboBox to multi select , but it doesn't work.

在 ExtJS 3.3.1 中,我尝试将 comboBox 设为 multi select ,但它不起作用。

Please help.

请帮忙。

 var mArray = new Array("ALL", "AAA", "BBB");
        var mCombo = new Ext.form.ComboBox({ id: 'ID', fieldLabel: 'ID',
            triggerAction: 'all',
            height: 100, width: 163,
            multiSelect: true,
            store: mArray
        });
        Ext.getCmp('mCombo').setValue("ALL");

回答by Li0liQ

There isn't a config option like multiSelectin Ext.form.ComboBox.
To get desired functionality you either need to develop a multiselect combobox by your own or use one of existing alternatives, like Ext.ux.form.CheckboxCombo, Ext.ux.form.SuperBoxSelectand Ext.ux.form.LovCombo.

没有像一个配置选项multiSelectExt.form.ComboBox
要获得所需的功能,您要么需要自己开发多选组合框,要么使用现有的替代方案之一,例如Ext.ux.form.CheckboxComboExt.ux.form.SuperBoxSelectExt.ux.form.LovCombo

回答by trevone

return new Ext.form.ComboBox({
                            fieldLabel: fieldLabel,
                            hiddenName: name,
                            store: store ,
                            valueField:'value',
                            displayField:'value',
                            typeAhead: true,
                            mode: 'local',
                            triggerAction: 'all',
                            emptyText:'Select '+fieldLabel+' ...',
                            selectOnFocus:true,
                            allowBlank:allowBlank,
                            forceSelection : true,
                            disabled:disabled,
                            multiSelect:true,
                            width:200,
                            id:id,
                            listeners:{
                                change : function( frm, newValue, oldValue ) {
                                    doRenderTL();
                                }
                            },
                            renderTo: Ext.get( renderTo )
                        });