-
25 Nov 2012 7:24 AM #1
Unanswered: callback in store.save()
Unanswered: callback in store.save()
Hi,
could any one pls let me know whether store.save() has callback method in sencha touch 1.1.1? how do i know whether the save() is successful without callback()?
Thanks
-
27 Nov 2012 5:37 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
For ST1, you would have to add a write listener to see if it is successful, exception if it is not.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
28 Nov 2012 6:38 AM #3
Hi mitchellsimoens,
Thanks for your response.
Could you pls give sample code...Code:Ext.data.AbstractStore.override({ sync: function (config) { config = config || {}; var defaults = { callback: Ext.emptyFn, scope: this } config = Ext.apply(defaults, config); var me = this, options = {}, toCreate = me.getNewRecords(), toUpdate = me.getUpdatedRecords(), toDestroy = me.getRemovedRecords(), needsSync = false; if (toCreate.length > 0) { options.create = toCreate; needsSync = true; } if (toUpdate.length > 0) { options.update = toUpdate; needsSync = true; } if (toDestroy.length > 0) { options.destroy = toDestroy; needsSync = true; } if (needsSync && me.fireEvent('beforesync', options) !== false) { var batch = me.proxy.batch(options, me.getBatchListeners()); batch.on('complete', Ext.bind(config.callback, config.scope, [this, options]), this, {single:true}); } } });
I have tried using the above code. but ext.bind is not working in ST1.
Thanks


Reply With Quote