PDA

View Full Version : [CLOSED] Store.sync() - no changes made calls neither 'success' or 'callback'



jlove
7 Apr 2014, 8:02 PM
I have code within a viewController, which accesses a store within a ViewModel, it calls:

this.getView().getViewModel().data.mystore.sync()

I pass in a function for both 'success' and for 'callback'.

If I make changes - add or edit a field, I get the appropriate call.

If I make no changes, I get no callback.

If this is intended, great -I have missed a way to identify whether a store will perform any sync changes or not.

If this is unintended, I guess it's a bug.

brian428
8 Apr 2014, 7:21 AM
I agree. A sync() call if there are no changes pending should not just do nothing. I would say just have it immediately fire the success callback/success function.

On a related note, I would add a convenience method to Store called hasChanges(). Return true if there are any removed/modified records. Currently, folks have to manually check both getModifiedRecords() and getRemovedRecords() to determine if there are any pending changes. This could be made easier with a simple convenience method.

lukas.steiner@websoft.ch
31 Mar 2015, 5:58 AM
upvote

mhenn
5 Jun 2015, 12:25 AM
upvote

COSJW
15 Apr 2016, 3:30 AM
Any fixes made? Or is there some workaround? The one "look if there are changes" is not acceptable.

alexey.lukin
5 Sep 2016, 1:47 AM
upvote

llamerr
5 Sep 2016, 2:21 AM
I added override for Ext.data.ProxyStore, few lines at the bottom of sync method


if ( needsSync && me.fireEvent('beforesync', operations) !== false ) {
...
else {
options = options || {};
var scope = options.scope || this;
if ( Ext.isFunction(options.callback) ) {
Ext.callback(options.callback, scope, [ me.proxy.batch, options ]);
}
}


not sure how correct it is, but it works for me