I have this controller:
Code:
Ext
.define(
'TestApp.controller.TestController',
{
extend : 'Ext.app.Controller',
config : {
refs : {
testList : '.testView',
}
},
init : function() {
console.log('TestApp.controller.TestController init');
this.control({
testList : {
show : this.onShow,
hide : this.onHide
}
});
var testStore = Ext.getStore('testAppStoreId');
testStore
.on(
'load',
function(store, records, success,
operation, eOpts) {
console
.log('TestApp.controller.TestController onStoreLoad');
console.log(success);
});
},
onShow : function(component, eOpts) {
console.log('TestApp.controller.TestController onShow');
var testList = this.getTestList();
var testStore = testList.getStore();
testStore
.load({
callback : function(records, operation,
success) {
console
.log('TestApp.controller.TestController onLoaded');
console.log(records);
},
scope : this
});
},
onHide : function(component, eOpts) {
console.log('TestApp.controller.TestController onHide');
}
});
and CRUD functionality in my proxy:
Code:
Ext.define('TestApp.proxy.TestProxy', {
extend : 'Ext.data.Proxy',
create : function(operation, callback, scope) {
console.log('proxy create');
},
update : function(operation, callback, scope) {
console.log('proxy update');
},
destroy : function(operation, callback, scope) {
console.log('proxy destroy');
},
read : function(operation, callback, scope) {
console.log('proxy read');
operation.setStarted();
var items = [];
var item = {
id : 1,
value : 'item1'
};
items.push(item);
operation.resultSet = Ext.create('Ext.data.ResultSet', {
records : items,
total : items.length,
success : true,
loaded : true
});
operation.setCompleted();
operation.setSuccessful();
}
});
var storeProxy = Ext.create('TestApp.proxy.TestProxy', {});
Ext.define("TestApp.model.TestModel", {
extend : "Ext.data.Model",
config : {
fields : [ {
name : "id",
type : "int"
}, {
name : "value",
type : "string"
} ],
proxy : storeProxy
}
});
How come the 'load' event never gets called in my controller. I do see the 'proxy read' console.log statement in the console. Help?