1. #1
    Sencha User andy370's Avatar
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    1
    Answers
    2
    andy370 is on a distinguished road

      0  

    Default Unanswered: Uncaught TypeError on date field when jsonp returns null value

    Unanswered: Uncaught TypeError on date field when jsonp returns null value


    My model:
    Code:
    Ext.define('MyApp.model.InvoiceLookup_Model', {
        extend: 'Ext.data.Model',
        config: {
            fields: [{
                    name: 'invoiceId'
                },{
                    name: 'transactionDate',
                    type: 'date'
                },{
                    name: 'invoiceNumber'
                },{
                    name: 'invoiceTotal'
                },{
                    name: 'invoiceStatus'
                }
    ]}});
    gets populated via jsonp:
    Code:
    {"invoiceId":null,"invoiceTotal":null,"invoiceNumber":null,"invoiceStatus":null,"transactionDate":null}
    gives me this error:
    Code:
    Uncaught TypeError: Cannot call method 'toString' of null sencha-touch-all-debug.js:18098
     Ext.apply.DATE.convert sencha-touch-all-debug.js:18098
     Ext.define.setData sencha-touch-all-debug.js:66568
     Ext.define.constructor sencha-touch-all-debug.js:66474
     Class sencha-touch-all-debug.js:4913
     Ext.define.processRead sencha-touch-all-debug.js:17511
     Ext.define.process sencha-touch-all-debug.js:17499
     Ext.define.processResponse sencha-touch-all-debug.js:43784
     (anonymous function) sencha-touch-all-debug.js:44215
     Ext.apply.callback sencha-touch-all-debug.js:9475
     Ext.define.handleResponse sencha-touch-all-debug.js:17143
     (anonymous function) sencha-touch-all-debug.js:3149
     (anonymous function) Mobile:1
    But the error (and formatting on non-null records) goes away if I take away the type: 'date' property. Is this a bug or am I doing something wrong?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,679
    Vote Rating
    435
    Answers
    3111
    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


    With this store:

    Code:
    new Ext.data.Store({
        autoLoad  : true,
        model     : 'MyApp.model.InvoiceLookup_Model',
        proxy     : {
            type : 'jsonp',
            url  : 'data/php.php'
        },
        listeners : {
            load : function() {
                console.log(arguments);
            }
        }
    });
    and exactly this response (actual JSONP not JSON)

    Code:
    Ext.data.JsonP.callback1({"invoiceId" : null, "invoiceTotal" : null, "invoiceNumber" : null, "invoiceStatus" : null, "transactionDate" : null});
    I do not get any errors in 2.0.1.1, 2.1.0 RC1
    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 andy370's Avatar
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    1
    Answers
    2
    andy370 is on a distinguished road

      0  

    Default


    Sorry, I didn't show you my actual response:
    Code:
    Ext.data.JsonP.callback11({"invoiceId":null,"invoiceTotal":null,"invoiceNumber":null,"invoiceStatus":null,"transactionDate":null});
    On a hunch I changed:
    Code:
    <script src="../sencha-touch-2.1.0-b1/sencha-touch-all-debug.js"></script>
    To:
    Code:
    <script src="../sencha-touch-2.1.0-b1/sencha-touch-all.js"></script>
    In my index.html and *tada*, it's working. So apparently debug has a bug in it.

Tags for this Thread