1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    29
    Answers
    2
    Vote Rating
    1
    Dafram is on a distinguished road

      0  

    Default Answered: 4.1.1 - How to setValue of a comboBox with multiSelect: true ?

    Answered: 4.1.1 - How to setValue of a comboBox with multiSelect: true ?


    Hi!

    How can I set the value of a combobox with multiSelect = true?

    my code (working in ExtJs 4.0.7) doesn't work in 4.1.1:

    Code:
            var cbCaratteristica = Ext.create('Ext.form.field.ComboBox', {
                name: 'cbCaratteristica',
                id: 'id_cbCaratteristica',
                fieldLabel: 'Caratteristica',
                displayField: 'cadesc',
                valueField: 'idcara',
                width: 450,
                labelWidth: 100,
                store: storeCaratteristica,
                queryMode: 'local',
                allowBlank: false,
                forceSelection: true,
                multiSelect: true
            });
    
    ...
    
            function setValCbCaratteristica()
            {
                var_caratteristica = "1,2"; // the same with "1, 2"
                cbCaratteristica.reset();
                cbCaratteristica.setValue(var_caratteristica);
            }
    My example: http://www.electricblueskies.com/smeraldo/es03.html

  2. NB: displayField is different from valueField.

    I try to set value using value field...

    Any suggestion?

  3. #2
    Sencha User
    Join Date
    Feb 2012
    Posts
    29
    Answers
    2
    Vote Rating
    1
    Dafram is on a distinguished road

      0  

    Default


    NB: displayField is different from valueField.

    I try to set value using value field...

    Any suggestion?

  4. #3
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      2  

    Default


    Try to use array of values instead of string.
    Code:
    var_caratteristica = [1, 2];
    cbCaratteristica.reset();
    cbCaratteristica.setValue(var_caratteristica);

  5. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    29
    Answers
    2
    Vote Rating
    1
    Dafram is on a distinguished road

      0  

    Default


    I found a thing.

    For combobox ["1","2"] is different from [1,2]

Thread Participants: 1

Tags for this Thread