Forum /
Sencha Touch 2.x Forums /
Sencha Touch 2.x: Q&A /
Answered: Loading a store from a controller causing the last dataitem action to fire again
Answered: Loading a store from a controller causing the last dataitem action to fire again
Hey this is really weird.
I have a dataview that shows a list of dataitems.
Each data item has a checkbox.
Since I didn't know how to catch the 'check' event from inside the dataitem itself, I've caught this event from a controller.
Whenever I load the store I'm using the controller to change it's proxy and load it manually because I re-use it all over my app.
The problem is, that the last action I do with the 'check' event keep firing again and again every time I load the store.
This is really weird, and it drive me crazy.
Thanks for the help!
Best Answer Posted by
Monti123
I came up with the following workaround, adding a listener to the store:
listeners: {
beforeload: function( store, operation, eOpts ) { //A workaround to make the follow actions not to fire again.
console.log('Before load');
return true;
}
},
Don't know why this works, but it does.
Sencha - Senior Forum Manager
Are you loading the store somewhere else you are using the store?
I'm changing the proxy and loading the manually:
Ext.getStore('StoreId').getProxy().setUrl(ServerAddress+'RestService.svc/ShowLeagues/'+UserId');
Ext.getStore('StoreId')..load(function(records, operation, success) {
console.log('loaded records');
}, this);
2 views are using the same store, and 1 view is actually a generic view, that loads the store in according to it's context.
I came up with the following workaround, adding a listener to the store:
listeners: {
beforeload: function( store, operation, eOpts ) { //A workaround to make the follow actions not to fire again.
console.log('Before load');
return true;
}
},
Don't know why this works, but it does.
Doesn't work.
Doesn't work.
Actually, my workaround doesn't work anymore for some reason.
Probably was unstable.
I need help
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us