Thanks again Aaron for your reply.
I'm not sure to understand completely what you mean. I use now the cfg when I call the constructor to overwrite the defaults which I need to set. But I still have one remaining problem.
In MyStoreClass.js file the designer instantiates the store. In my case the store should not be instantiated as soon as the javascripts are loaded, as I will need to instantiate this store only once I know more details about what the user wants to do.
Code:
...
* This file will be auto-generated each and everytime you export.
*
* Do NOT hand edit this file.
*/
FreePriceElementStore = Ext.extend(Ext.data.JsonStore, {
constructor: function(cfg) {
cfg = cfg || {};
FreePriceElementStore.superclass.constructor.call(this, Ext.apply({
storeId: 'FreePriceElementStore',
idProperty: 'id',
sortField: 'country',
autoLoad: true,
remoteSort: true,
sortDir: 'ASC',
root: 'results',
fields : [
{
name: 'country',
mapping: 'priceComponent.country'
},
{
name: 'modificationDate',
dateFormat: 'd/m/Y H:i:s',
type: 'date'
},
{
name: 'id'
},
{
name: 'priceComponent'
}
]
}, cfg));
}
});
new FreePriceElementStore(); // <<<<<<<< I need to remove this.
I instantiate this class in my code like this:
Code:
FreeElementsWindow = Ext.extend(FreeElementsWindowUi, {
initComponent: function() {
new FreePriceElementStore({
url:zenurl.salesadmin_getContractFreeElementRecords,
autoDestroy:true,
listeners:{
beforeload: function(store, options){
options.params["contract.id"] = this.contract.id;
},
scope:this
}
});
FreeElementsWindow.superclass.initComponent.call(this);
this.addFreeElementsBtn.on("click", this.onAddFreeElementsBtn, this);
},
onAddFreeElementsBtn: function(){
console.log("onAddFreeElementsBtn");
},
....
I think for me the current implementation of the designer would be fine if I could tell it not to instantiate the store. I can only instantiate this store once I know which contract the user selected. Once I know this I can show the grid and instantiate the store with the proper parameters to be sent. Do I make sense? Thanks