
Originally Posted by
Animal
All those pages seem quite opaque in what actually happens.
Can you post some possible example of what you would like to happen?
PHP Code:
// Proposal
var gridStore, detailsStore, tree, grid, form;
tree.on('click', function(tree, record){
var promise = gridStore.load({id : record.get('id')});
promise.success(detailsStore.load).success(form.update).failure(form.showError);
});
// instead of something like this.
tree.on('click', function(tree, record){
gridStore.load({
id : record.get('id'),
callback : function(r, o, success){
if (success) {
detailsStore.load({
callback:function(r, o, success){
if (success) {
form.update(record);
} else {
form.showError();
}
}
});
} else {
form.showError();
}
}
});
});
It's not just callbacks. It is a different way of dispatching events. The real problem I see is the challenge of Sencha to provide an api which *is* deferable. Without chaining support (like jQuery) it is useless.
Again, an example of jQuery promise implementation:
PHP Code:
var ajaxPromise = $.ajax('myurl').done(function(response){
console.info("the response: " + response);
}).fail(function(){
console.warn(arguments);
});
// oops, I need additional callbacks?
ajaxPromise.done(function(){
console.info('done!!');
}).always(function(){
console.log("whatever happend, I'm here");
});