Dojo中的MultiSelectCombobox问题 [英] MultiSelectCombobox issue in dojo

查看:172
本文介绍了Dojo中的MultiSelectCombobox问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用每个选项前面的复选框的组合框来选择多个选项。我尝试使用checkedMultiSelect使用dropdown:true,

I needed the combobox with checkboxes in front of each option, to select multiple options. I tried using CheckedMultiSelect using "dropdown:true",

它显示了组合框中的值,例如2个选择的项目,1个选择的项目等当我选择项目。

It shows the value in the combobox like, 2 item(s) selected, 1 item(s) selected,etc when I select items.

如何显示在分隔符分隔的组合框的文本区域中选择的值?

How to show the values selected in the text area of combobox separated by delimiter??

应该css或HTML或其他一些必须更改为checkedMultiSelect?

Should css or HTML or someotherthing has to be changed for checkedMultiSelect??

提前感谢。

推荐答案

对于您的第二个问题,您必须扩展 dojox.form.CheckedMultiSelect class并覆盖 _updateSelection 启动方法:

As for your second question, you have to extend dojox.form.CheckedMultiSelect class and override _updateSelection and startup methods:

var MyCheckedMultiSelect = declare(CheckedMultiSelect, {

    startup: function() {
        this.inherited(arguments);  
        setTimeout(lang.hitch(this, function() {
            this.dropDownButton.set("label", this.label);            
        }));
    },

    _updateSelection: function() {
        this.inherited(arguments);                
        if(this.dropDown && this.dropDownButton) {
            var label = "";
            array.forEach(this.options, function(option) {
                if(option.selected) {
                    label += (label.length ? ", " : "") + option.label;
                }
            });

            this.dropDownButton.set("label", label.length ? label : this.label);
        }
    }

});

使用 MyCheckedMultiSelect 而不是 dojox.form.CheckedMultiSelect

var checkedMultiSelect = new MyCheckedMultiSelect ({
    dropDown: true,
    multiple: true,
    label: "Select something...",
    store: dataStore
}, "placeholder");

checkedMultiSelect.startup();

再次,我将其添加到了jsFiddle: http://jsfiddle.net/phusick/894af/

Again, I added this to the jsFiddle: http://jsfiddle.net/phusick/894af/

这篇关于Dojo中的MultiSelectCombobox问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆