-1

I have a multiselect combobox which is targetcombo of another combobox.

Following are some values from database.

101 - Pink
102 - Red
103 - Dark Blue

I am setting value of combobox using setValue. But I found that it works only if the value does not contain space. For example-

combobox1.setValue(101);   // Works
combobox1.setValue(102);   // Works
combobox1.setValue(103);   // Does Not Work

Also,

var val = '101,102';
combobox1.setValue(val.split(',')); // Works well. Displays 'Pink, Red'

But

var val = '101,103';
combobox1.setValue(val.split(',')); // Displays only 'Pink'

Am I doing anything wrong here? or missed anything. Is the issue relalted to targetcombo. Please help.

Microsoft DN
  • 9,706
  • 10
  • 51
  • 71
  • 1
    I have created fiddle for you https://fiddle.sencha.com/#view/editor&fiddle/1p50 , the setValue(103) works for me. But I don't understand what you mean with that value split. You can have multiple values there? It does not work for me. Could you recreate your exact problem with the fiddle? – pagep Jan 29 '17 at 12:13

1 Answers1

0

Better to use Ext.form.field.Tag. Because Combo multiselect is deprecated since version 5.1.0.

Ext.define('Ext.form.field.Tag', {
    items: [
        {
            xtype: 'tagfield',
            id: 'tagF',
            valueField: 'value',
            store: 'CustomStore',
        },
        {
            xtype: 'button',
            handler: function(button, e) {
                Ext.first('#tagF').setValue(101)
            },
            text: '101'
        },
        {
            xtype: 'button',
            handler: function(button, e) {
                Ext.first('#tagF').setValue(102)
            },
            text: '102'
        },
        {
            xtype: 'button',
            handler: function(button, e) {
                Ext.first('#tagF').setValue(103)
            },
            text: '103'
        },
        {
            xtype: 'button',
            handler: function(button, e) {
                var val = '101,102';
                Ext.first('#tagF').setValue(val.split(','));
            },
            text: 'split'
        }
    ]

});
Makha
  • 317
  • 3
  • 16