Clay Banks
Clay Banks

Reputation: 4581

Putting 'store' data into a combobox

I'm trying to simply store a 'store's data into a combobox that can be selected.

Here's my store.Users:

Ext.define('AM.store.Users', {
    extend: 'Ext.data.Store',
    model: 'AM.model.User',
    fields: ['name', 'email'],
    data: [
        {name: 'Ed Hayes',    email: '[email protected]'},
        {name: 'Tommy Gunz', email: '[email protected]'},
        {name: 'Johnny Bravo',  email: '[email protected]'},
        {name: 'Billy Joe', email: 'billyJgeemail.com'},
        {name: 'James Bond', email: '[email protected]'}
    ]
});

Here's my app.js:

 items: [
    { xtype: 'panel', 
      padding: 5, 
      height: 500, 
      width: '35%',
      items: [
          { 
            xtype: 'combobox', 
            padding: 5, 
            fieldLabel: 'Criteria', 
            stores: 'AM.store.hello' 
          }
      ]
    }, ...

Currently this is not working, any ideas?

Upvotes: 0

Views: 502

Answers (2)

Aminesrine
Aminesrine

Reputation: 2140

You should specify combobox properties correctly, especially, a store and a displayField:

{
    xtype: 'combobox',
    fieldLabel: 'Criteria',
    displayField: 'name',// or email
    name:..,
    valueField:..
}

Upvotes: 0

kevhender
kevhender

Reputation: 4405

You are using stores, when the correct config property is store. See the docs for ComboBox here: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.ComboBox-cfg-store

Upvotes: 3

Related Questions