1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    6
    Vote Rating
    0
    senchaNewbee is on a distinguished road

      0  

    Default Unanswered: Setting the value of a Combo Box outside of the array

    Unanswered: Setting the value of a Combo Box outside of the array


    I have this script that sets the variables for combo vJobName

    this.vJobName.setRawValue(vars.vJobName);

    The combo box is used to display an A-Z index which opens a display list. The entry accepted from the display list then needs to show up in the combo box.

    So if a search for "A" an item in the combo box. And in the display list I select "Alpha" I want "Alpha" to be displayed in the combo box.

    I understand Alpha is not one of the elements in the array of the combo but is it possible to display this value? I have tried to force the display and setting various other config options but they dont seem to work.

    The code in the form looks like this:

    this.vJobName = Ext.create('AbsNet.view.widget.CustomComboBox', {
    name: 'vJobName',
    width: 383,
    editable: true,
    action: 'vJobName',
    style: {
    marginRight: '5px'
    }
    });

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,085
    Answers
    675
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    I do not understand your question. Please see the following code and make adjustments as needed

    Code:
    // The data store containing the list of states
    var states = Ext.create('Ext.data.Store', {
        fields: ['abbr', 'name'],
        data : [
            {"abbr":"AL", "name":"Alabama"},
            {"abbr":"AK", "name":"Alaska"},
            {"abbr":"AZ", "name":"Arizona"}
            //...
        ]
    });
    
    // Create the combo box, attached to the states data store
    var combo = Ext.create('Ext.form.ComboBox', {
        fieldLabel: 'Choose State',
        store: states,
        queryMode: 'local',
        displayField: 'name',
        valueField: 'abbr',
        renderTo: Ext.getBody()
    });
    
    combo.setValue('AK'); // select value, but display description
    Regards,
    Scott.

Thread Participants: 1