PDA

View Full Version : Different stores with different (so I thought) proxies WTF !?



armandoxxx
8 Dec 2012, 2:27 AM
Hey guys ..

Need a little explanation about proxies ...
I've got a form with components that call same URL through it's storage proxies.
The problem is with extra params ...
In some cases I have to set extra parameters to a proxy .. and ALL proxies now have that same parameters !!!

copy paste from debug window:


proxy from store 1:
constructor {type: "ajax", url: "http://fukec:8080/kliping-admin/rest/extEntities/searchEntities", extraParams: Object, reader: constructor, hasListeners: HasListeners…}
api: Object
events: Object
extraParams: Object
language: "en"
type: "5a0d42a3-da66-3452-a44a-e9b36100a44a"
__proto__: Object
hasListeners: HasListeners
model: function constructor() {
nocache: true
reader: constructor
type: "ajax"
url: "http://fukec:8080/kliping-admin/rest/extEntities/searchEntities"
writer: constructor
__proto__: TemplateClass


proxy from store 2:
constructor {type: "ajax", url: "http://fukec:8080/kliping-admin/rest/extEntities/searchEntities", extraParams: Object, reader: constructor, hasListeners: HasListeners…}
api: Object
events: Object
extraParams: Object
language: "en"
type: "5a0d42a3-da66-3452-a44a-e9b36100a44a"
__proto__: Object
hasListeners: HasListeners
model: function constructor() {
nocache: true
reader: constructor
type: "ajax"
url: "http://fukec:8080/kliping-admin/rest/extEntities/searchEntities"
writer: constructor
__proto__: TemplateClass





check the type extra parameter .. it's in both proxies ... and I only set it once on second proxy!

Any explanation and/or fix would be appreciated!

Regards

Armando

Arg0n
8 Dec 2012, 3:10 AM
It seems, that your proxies don't share the same parameters... your stores share the same proxies xD
Do you really use 2 different stores?

armandoxxx
8 Dec 2012, 3:19 AM
Hey

Yes I use two different stores..

Ext.create('store1', {storeId:'store1'});
Ext.create('store2', {storeId:'store2'});

is the code .. and console throws 2 different stores out ..

but I found out what was the problem ...

old code:


Ext.require('model.NamedEntity');
Ext.define('store.NamedEntity', {
extend : 'Ext.data.Store',
model : 'model.NamedEntity',
autoLoad : false,
pageSize : 50,
proxy : {
type : 'ajax',
url : FORM_SEARCH_ENTITIES_PATH,
extraParams : {
language : Dict.getDefaultLanguage()
},
reader : {
type : 'json',
root : 'data',
totalProperty : 'total'
}
}

});



new code :


Ext.require('model.NamedEntity');


Ext.define('store.NamedEntity', {

extend : 'Ext.data.Store',

constructor : function(theConfig) {

Ext.apply(this, {
model : 'model.NamedEntity',
autoLoad : false,
pageSize : 50,
proxy : {
type : 'ajax',
url : FORM_SEARCH_ENTITIES_PATH,
extraParams : {
language : Dict.getDefaultLanguage()
},
reader : {
type : 'json',
root : 'data',
totalProperty : 'total'
}
}
});
this.initConfig(theConfig);
this.callParent(arguments);
}
});


they shared properties on create !!!


Regards

Armando