Results 1 to 3 of 3

Thread: callback in store.save()

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    6
    Vote Rating
    0
      0  

    Default 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

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,062
    Answers
    3976
    Vote Rating
    1391
      0  

    Default

    For ST1, you would have to add a write listener to see if it is successful, exception if it is not.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    6
    Vote Rating
    0
      0  

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •