-
13 Sep 2011 12:33 PM #11Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
We're looking at how to improve support for this in 4.1 and 4.2, it's too hard right now
Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer
-
20 Sep 2011 12:00 PM #12
success handler bug
success handler bug
Thanks, all, for this; it helped me isolate a problem I was having in Ext 4.0.2. In my code, I had success/failure handlers on the save events:
The success handler wasn't being called, and I isolated why. Here's the 4.0.2 save function definition:PHP Code:record.save({
success : function(record) {
//MyData.object stores some variables before this.
var record = MyData.object.record;
record.commit();
var win = MyData.object.window;
win.close();
var s = MyData.object.store;
s.sync();
},
failure : function(record, op) {
Ext.Msg.alert("Save error!",
op.request.scope.reader.jsonData["error"]);
}
});
These two rows each fail silently:PHP Code:save: function(options) {
options = Ext.apply({}, options);
var me = this,
action = me.phantom ? 'create' : 'update',
record = null,
scope = options.scope || me,
operation,
callback;
Ext.apply(options, {
records: [me],
action : action
});
operation = Ext.create('Ext.data.Operation', options);
callback = function(operation) {
if (operation.wasSuccessful()) {
record = operation.getRecords()[0];
//we need to make sure we've set the updated data here.
//Ideally this will be redundant once the
//ModelCache is in place
me.set(record.data);
record.dirty = false;
Ext.callback(options.success, scope, [record, operation]);
} else {
Ext.callback(options.failure, scope, [record, operation]);
}
Ext.callback(options.callback, scope, [record, operation]);
};
me.getProxy()[action](operation, callback, me);
return me;
},
If you don't have a success callback, you won't see an error; your success callback just won't get called I've overridden these two lines in my code, and all seems well.PHP Code:me.set(record.data);
record.dirty = false;
Has anyone else seen this?
JoshUsing:
ExtJS 2.2, 3.2, 4.0.7a
WinXP SP3
FF10,6; IE6; IE8; Safari
-
9 Oct 2011 8:41 AM #13
The problem is here -
But, operation.getRecords method is undefined.HTML Code:record = operation.getRecords()[0];
So, I'm using
PHP Code:record = operation.records[0];
-
9 Oct 2011 10:32 PM #14Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
We've given sync the ability to take callbacks in 4.1, we'll get it into your hands as quickly as possible. Sorry for shipping such a difficult API in 4.0
Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer
-
25 Apr 2012 3:58 AM #15
Can I use success() and failure() function inside store.load({}) in ExtJs4?
I tried ,But its not working .
My code as :
store.load({
success: function(rec, op) {
alert('success');
},
failure: function(rec, op) {
alert('failure');
}
});
I have tried also using callback function() inside store.load() , but unfortunately its also not working.
Please provide some reasonable solution as soon as possible.
-
27 Apr 2012 2:33 AM #16
4.1 store sync callback abilities
4.1 store sync callback abilities
the documantation says there is success callback ability added to 4.1 but i cant get it work, someone can try it?
-
28 Apr 2012 2:32 AM #17
But I am using ExtJs4.0 .
Can any one give solution how to get json data from service response which should reflect on the grid ?
Please give me the solution as soon as possible.
I have used callback() function inside store.load({});
It is working some times after debugging the store.load({}) and some times its not working .
I have tried a lot.
If anybody have any suggestion , Please clarify.
I need yours help.
Thank you
-
15 Jun 2012 9:51 AM #18
bump this, i can't get it work on extjs 4.1 either.
-
17 Jun 2012 11:10 AM #19
.Extjs 4.1-rc2, store with REST proxy, on server side nodeJS + expressJS work for me:As for API. Call `store.sync()` returns useless store itself. But `return needsSync` will say that there will be no async calls to either handler, which is great to know BTW. It's possible to make finishing job right now.Code:store.sync({success: sfun(batch, opts), failure: ffun(batch, opts)})
-
30 Aug 2012 12:42 AM #20
ExtJS 4.1.1 src\data\AbstractStore.js
ExtJS 4.1.1 src\data\AbstractStore.js
While doing store sync there are 3 possible code branches:
Code:sync_processing_ui_updates()
Code:if(needsSync) success_call_back_ui_updates()
Code:if(needsSync) fail_call_back_ui_updates()
Thus returning needsSync from store.sync() call manages all possible branches easily.Code:if(!needsSync) no_sync_call_ui_updates()


Reply With Quote