View Full Version : Using a Combobox with a different store in MVC

5 Jun 2013, 1:50 PM
I have a combobox that uses data store, and I could easily create and use when I was not using MVC. But I switched to MVC, and having problem using this field.

The following is my sample code without MVC.

xtype: 'combobox',
width: 300,
store: Ext.create('MyApp.store.MyStore'),
displayField: 'name',
valueField: 'code',
fieldLabel: 'User Name',
name: 'code',
typeAhead: false,
hideTrigger: true,
minChars: 1,
listConfig: {
loadingText: 'Searching...',
emptyText: 'No matching posts found.',
getInnerTpl: function() {
return '<div class="search-item">' +
'<h3><span>{name} ({code})</span></h3>' +
listeners: {
scope: this,
select: function( combo, records, options) {
this.onSelect( records[0]);

Appreciate any help or pointers to examples.

Best Regards

7 Jun 2013, 9:42 AM
Is your MyStore class defined in appfolder/store/MyStore.js?
And I take it your application name is MyApp, yes?

8 Jun 2013, 12:31 AM
In your viewport within 'stores' config array add your 'MyStore'

and define the store config option in view like this:

store: 'MyStore'