Results 1 to 2 of 2

Thread: How to reject record on server exception

  1. #1
    Sencha User
    Join Date
    Apr 2010
    Vote Rating

    Default Unanswered: How to reject record on server exception

    When you save a record with proxy and a server exception occurs, how can I reject the record? Callback function is not called, and there is no exception function on

    I did find an ugly workaround, but there's gotta be a better way to do this ... or not???

    // record with a fully working proxy
    var record;
    // create exception handler
    var exceptionFn = Ext.bind(function(record) {
         // reject record
         // remove listener if exception occured'exception', exceptionFn);
    }, this, [record]);
    // listen to exceptions'exception', exceptionFn);
    // save record{
         callback: function(records, operation) {
             // this never gets called if server exception occurs
             // remove listener if exception did not occur
   'exception', exceptionFn);

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    Couple issues I see. Using means you may have multiple requests bundled into a single request so if one fails then the others fail but that doesn't mean the record saving wasn't successful.

    You shouldn't allow the direct router to fire anything that wouldn't give a successful JSON reading meaning if there was a server side error (like a PHP error). Each request needs to have success true/false to tell each request is successful or not.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2

    Think my support is good? Get more personalized support via a support subscription.

    Need more help with your app? Hire Sencha Services

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Tags for this Thread

Posting Permissions

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