View Full Version : ArrayStore+combobox proxy error

20 May 2011, 5:55 AM
Greetings all. I have a DirectStore that contains records that I will use in multiple places in my application. One use is to populate a combobox within a form. I extended the DirectStore object with methods to return an array of all data within the store for use in an ArrayStore. The ArrayStore is then bound to the combobox.

The DirectStore is defined as:

masterCustomerStore : Ext.extend(Ext.data.DirectStore, {
constructor : function(){
var cfg = {
reader: new Ext.data.JsonReader({
root: 'data',
idProperty: 'id',
totalProperty: 'count',
fields: [
{name: 'id', mapping: 'id'},
{name: 'cid', mapping: 'cid'},
{name: 'name', mapping: 'name'}
proxy: new Ext.data.DirectProxy({
api: {
read: COI.ar.getContacts
baseParams: {user: COI.userProfile, ctype: 'Customer'},
fields: [
{name: 'id', type: 'int'},
{name: 'cid', type: 'string'},
{name: 'name', type: 'string'}
autoDestroy: true,
autoLoad: true
Ext.getCmp('COIAR').masterCustomerStore.superclass.constructor.call(this, cfg);

,getCustomerKeys : function(){
var recs = this.getRange(0, this.getCount());
var data = [];
Ext.each(recs, function(rec){
var d = rec.data;
t = [d.id, d.cid, d.name];

The getCustomerKeys method builds the array that will populate the ArrayStore. It is created with this config:

var te = new Ext.data.ArrayStore({
fields: ['id', 'cid', 'name'],
sortInfo: {
field: 'cid',
direction: 'ASC'
autoDestroy: true,
autoLoad: true,
data: []

I load the data manually after the store is defined and then I create the combobox:

new Ext.form.ComboBox({
store: te,
typeAhead: true,
allowBlank: false,
hiddenName: 'terms',
triggerAction: 'all',
lazyRender: true,
mode: 'local',
width: 100,
valueField: 'id',
displayField: 'terms',
fieldLabel: 'Terms',
value: 'Cash'

This works fine on the initial instance of the object. However, on second and subsequent invokations the "this.proxy.request" error is back. Any ideas on how to get past this? Much appreciated in advance.