Q:

Add values to a combobox

I have an xtype combo that I have created and want to add a Yes and No option for the user to select. This is the code that I have so far:
{
                        xtype:'combo',
                        fieldLabel: 'Option List',
                        id: 'option',
                        width: 40
                    }

Is there an easy way to add the values within the combo or am I going to have to create a whole cbTemplate with a Ext.data.store?

A:

The easiest way is to create the store inside the combobox:
Ext.create('Ext.form.ComboBox', {
    fieldLabel: 'Option List',
    store:  Ext.create('Ext.data.Store', {
        fields: ['name', 'id'],
        data : [
            {"name":"Yes", "id":"yes"},
            {"name":"No", "id":"no"}
        ]
    }),
    editable: false,
    queryMode: 'local',
    displayField: 'name',
    valueField: 'id',
    renderTo: Ext.getBody()
});

Here is a jsfiddle with the sample: http://jsfiddle.net/arunv/TrRHP/

