PDA

View Full Version : sencha touch 2 store loading problem



hossam.elmazen
7 Aug 2013, 1:56 PM
i have a controller, and a button tab event handler

inside the handler i created this code

var value = Ext.ComponentQuery.query('#UserIDtxt')[0].getValue();
var onlineStore = Ext.getStore('UserStore');




onlineStore.load({
params:{
'ID': value
}
});

if (onlineStore.getAt(0).data.UserName='not found')
{
//some code
}

in the last line i want tto check the data retrieved by the store,
my problem is that the store loading "load event" happens after the tab event, so that the store is empty on the check.

i want to check the data here because it will be redirected to another forms depends on these data.

thanks,

willigogs
8 Aug 2013, 1:42 AM
This isn't the Sench Touch forum, but to answer your question anyway...

You would need to move your store specific code underneath the store load event. So something like this:


var onlineStore = Ext.data.Store({
...Your store config options...
listeners: {
load: function(store, records, successful, operation, eOpts) {
if (records[0].get('UserName') == 'not found') {
//some code
}
}
}
});