I have a store that works well when I have put "autoLoad: true". Now I need to modify it to load if the login is correct.
My Store:
Code:
Ext.define('plataformatechnosite.store.Feeds', {
extend: 'Ext.data.Store',
config: {
model: 'plataformatechnosite.model.Feed',
//autoLoad: true,
storeId: 'feedsStore',
proxy: {
type: 'jsonp',
url:'http://xxxx.yyyy',
callbackKey: 'callback',
reader: {
type: 'json',
rootProperty: 'listaMedios'
},
callback: function(data) {
console.log("callback" + data);
},
afterRequest: function(req, res) {
console.log("Ahoy!", req.operation.response);
}
},
timeout: 3000, //milliseconds
listeners: {
load: function(store, records, success) {
console.log("Load: success " + success);
},
exception:function(proxy, response){
console.error(response.responseText);
}
}
}
});
My Controller:
Code:
Ext.define('plataformatechnosite.controller.Login', {
extend: 'Ext.app.Controller',
autoDestory:false,
config: {
refs: {
loginButton: {
selector: '#login',
xtype: 'button'
},
username: {
selector: '#user',
xtype: 'textfield'
},
password: {
selector: '#pass',
xtype: 'passwordfield'
},
mainTabPanel: {
selector: '#mainTabPanel',
xtype: 'tabpanel',
autoCreate: true
}
},
control: {
"loginButton": {
tap: 'onLoginButtonTap'
}
}
},
onLoginButtonTap: function(button, e, options) {
Ext.data.JsonP.request({
url: 'http://xxxx.zzzzz',
callbackKey: 'callback',
timeout : 100000,
params: {
usuario: this.getUsername().getValue(),
password: this.getPassword().getValue()
},
callback: function(data) {
//console.log("callback" + data);
},
success: function(result, request) {
console.log("txt:"+result);
if(result == true){
//load Store, WS Proxy
var cargarFeeds = Ext.getStore('feedsStore');
cargarFeeds.load();
var feeds = Ext.create('plataformatechnosite.view.Feeds');
Ext.Viewport.add(feeds);
Ext.Viewport.setActiveItem(feeds);
}else{
Ext.Msg.alert('Error', 'Los credenciales insertados no son correctos.', Ext.emptyFn);
}
},
failure: function(response) {
console.log("failure");
Ext.Msg.alert('Error', 'Existen problemas de conexion con el servidor.', Ext.emptyFn);
}
});
}
});
This does not work. The msg:
Code:
[WARN][plataformatechnosite.view.Feeds#applyStore] The specified Store cannot be found Console.js:35
Load: success true
For the messages seems to load the store but on screen I see nothing.
ideas? thankyou!