Gendaful
Gendaful

Reputation: 5802

Ext JS : How to configure combobox as multiselect and singleselect at runtime?

I am trying to dynamically configure the comboBox as multiselect and singleSelect at runtime. I used setMultiSelect(true) amd combo.multiSelect(true) but they did not work. Any suggestions?

Upvotes: 1

Views: 302

Answers (1)

Kyle Fransham
Kyle Fransham

Reputation: 1879

I'm surprised that this functionality is missing. Seems like functionality that could be added to the core. Here's an extension to Ext.form.ComboBox that does what you're looking for:

Ext.define('My.form.MultiSelectCombo', {
    extend: 'Ext.form.ComboBox',
    setMultiSelect: function(multiSelect) {
        var me = this;
        me.multiSelect = multiSelect;
        me.createPicker();
        me.reset();
    },
});

Here's an example of the MultiSelectCombo in action: http://jsfiddle.net/r3kv2/

Upvotes: 1

Related Questions