I want to get the onload event working on my configuration object.
The following works, except when I create
config.listeners={..}
(i think i need?) to replace
this.onload({...});
Do I even use the correct config? (I have no idea about event handling)
Ext.define('data.SimpleStore', { extend: 'Ext.data.Store' ,constructor: function (config) { config.url=config.url||"afsud"; //If no call, we assume that url has been passed. Pass neither and be shot config.id=config.url+'Store';//call should be unique, else its another set of headaches. //console.log(config); Ext.define(config.id+'M', { //for a painful reason, you cant have a store without a model extend: 'Ext.data.Model', fields: []//we figure these out anyways }); config.root=config.root||'data'; config.type=config.type||'json'; config.proxy= config.proxy||{ //note if we override our proxy, then server.php might not work as black magic type: 'ajax' ,url : config.url ,reader: { type: config.type//seriously if you want to change this, go away ,root: config.root//we assume. } }; config.model=config.id+'M';//model should match store anyway. Generic models are out of scope atm config.listeners={ //this.populateFields //Error'd }; this.callParent([config]); this.load({//This works, but its after the parent call, so not exactly what i want callback: function(records,operation,success){ var obj=Ext.decode(operation.response.responseText); this.add(obj[config.root]); console.log(this.getRange()); console.log(config); } }); } ,populateFields:function(){ console.log('ran'); // never happens } }); var s= Ext.create('data.Store',{url:'test.php'}); s.load();
source share