﻿icomefromthenet.Categories = new Ext.data.Store({
    reader: new Ext.data.JsonReader({
        fields: ['id', 'name'],
        root: 'rows'
    }),
    proxy: new Ext.data.HttpProxy({
        url: 'Services/ComboCategories.ashx'
    }),
    autoLoad: true
});


icomefromthenet.CustomCombo = Ext.extend(Ext.form.ComboBox, {
    // configurables anything what is here can be configured from outside
      name: 'Categories',
      text: 'Change Category',
      width: 120,
      emptyText: 'Select a Category...'
       
     , initComponent: function() { Ext.apply(this, {
      
            // anything here, e.g. items, tools or buttons arrays, cannot be changed from outside
           store: icomefromthenet.Categories,
           typeAhead: true,
           triggerAction: 'all',
           selectOnFocus: true,
           mode: 'local',
           displayField: 'name'
      
            }); // e/o apply
         // call parent
        icomefromthenet.CustomCombo.superclass.initComponent.apply(this, arguments);
    // after parent code here, e.g. install event handlers

    } // e/o function initComponent

}); // e/o extend

// register xtype
Ext.reg('xtCustomCombo', icomefromthenet.CustomCombo); 
