1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    6
    Vote Rating
    0
    tech_help is on a distinguished road

      0  

    Default 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

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,714
    Vote Rating
    438
    Answers
    3113
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      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 @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.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    6
    Vote Rating
    0
    tech_help is on a distinguished road

      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