-1

I have a combobox and I want to create a new store instance of that combo. I can see a store instance can be created by Ext.create('My.Store') but this is not availabel in Extjs 2.3.0

I tried

var comb= new this.combobox1.store; // Gives error store is not a constructor

and

var comb= new this.combobox1.getStore(); // com is undefined here

Any ides.

Microsoft DN
  • 9,706
  • 10
  • 51
  • 71

1 Answers1

0

I know this is a year late, but better late than never, since I came across it as unanswered, try this:

First create your store:

 var myComboStore = Ext.create('Ext.data.Store', {
     storeId:'myComboStore',
     fields: ['name', 'value'], 
     data: [
         {'name':'shelf1', 'value':'shelf1 val'}, 
         {'name':'shelf2', 'value':'shelf2 val'}, 
         {'name':'shelf3', 'value':'shelf3 val'}, 
         {'name':'shelf4', 'value':'shelf4 val'}  
     ] 
 });

Then in your combo config, assign the store. This panel (fp) is a simple form to hold the example combo.

var fp = {
  xtype      : 'form',
  frame      : true,
  labelWidth : 110,
    items: 
     {
         xtype: 'combobox',
         fieldLabel: 'My Combo',
         displayField: 'name',
         width: 320,
         store: myComboStore, // ASSIGN STORE TO COMBO
         queryMode: 'local',
         typeAhead: true,
         emptyText : '-none-',
         listeners : {
          //click events for item selection goes here
        }
    }

}

create a window for the panel to go in

  new Ext.Window({
      title   : '',
      layout  : 'fit',
      height  : 180,
      width   : 320,
      border   : false,
      items   : fp
  }).show();

Working Fiddle: https://fiddle.sencha.com/#fiddle/1cta