Results 1 to 2 of 2

Thread: Cannot change field value

  1. #1
    Sencha User
    Join Date
    Aug 2013
    Posts
    2
    Answers
    1

    Default Answered: Cannot change field value

    Hi, hope somebody can help me, since I have struggled with this all day, and tried all kind of things.

    I have a model which I use when doing a FileTransfer with Phonegab like this:

    Code:
    fileTransfer.upload( image.get('file'), encodeURI("http://snaplog.dk/api/v1/images/" + image.get('id') ), function( response ) { 
              image.set('server', true);
            }, function( error) {
                console.log( image );
                console.log( error );
                me.syncToServer();
            }, options);
    When it has successed then I true to set the server field of the image model to true, but I get the following error cause me app to stall:
    TypeError: 'null' is not an object (evaluating 'Ext.get(d).destroy')
    line: 1
    message: "'null' is not an object (evaluating 'Ext.get(d).destroy')"
    sourceURL: "file:///var/mobile/Applications/F031FFBC-9D0A-458D-8CC0-C63E2A7E38F2/SnapLog.app/www/app.js"

  2. I managed to work around this. the var does hold the model, that is for sure, but I just used a try and catch instead then the problem would not stop the application:

    Code:
    try { 
        image.set('server', true);
        me.syncToServer();
    } catch(e) { 
        me.syncToServer();
    }
    The model is changed fine this way even though the error is showing.

  3. #2
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    4,108
    Answers
    342

    Default

    What debugging have you done so far? Try adding Ext.Msg.alert('image',JSON.stringify(image)) to your callback to verify that the image var holds your model. Are you testing on device or simulator? What does the rest of your code look like? Have you required your model?
    Get more personalized support via a support subscription.

    Need more help with your app? Hire Sencha Services [email protected]

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

    Need to include a test case use:
    The official Sencha Fiddle

  4. #3
    Sencha User
    Join Date
    Aug 2013
    Posts
    2
    Answers
    1

    Default

    I managed to work around this. the var does hold the model, that is for sure, but I just used a try and catch instead then the problem would not stop the application:

    Code:
    try { 
        image.set('server', true);
        me.syncToServer();
    } catch(e) { 
        me.syncToServer();
    }
    The model is changed fine this way even though the error is showing.

Posting Permissions

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