-
2 Oct 2012 11:04 AM #1
Unanswered: Uncaught TypeError on date field when jsonp returns null value
Unanswered: Uncaught TypeError on date field when jsonp returns null value
My model:
gets populated via jsonp: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' } ]}});
gives me this error:Code:{"invoiceId":null,"invoiceTotal":null,"invoiceNumber":null,"invoiceStatus":null,"transactionDate":null}
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?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
-
4 Oct 2012 7:30 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,666
- Vote Rating
- 435
- Answers
- 3109
With this store:
and exactly this response (actual JSONP not JSON)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); } } });
I do not get any errors in 2.0.1.1, 2.1.0 RC1Code:Ext.data.JsonP.callback1({"invoiceId" : null, "invoiceTotal" : null, "invoiceNumber" : null, "invoiceStatus" : null, "transactionDate" : null});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.
-
4 Oct 2012 7:45 AM #3
Sorry, I didn't show you my actual response:
On a hunch I changed:Code:Ext.data.JsonP.callback11({"invoiceId":null,"invoiceTotal":null,"invoiceNumber":null,"invoiceStatus":null,"transactionDate":null});
To:Code:<script src="../sencha-touch-2.1.0-b1/sencha-touch-all-debug.js"></script>
In my index.html and *tada*, it's working. So apparently debug has a bug in it.Code:<script src="../sencha-touch-2.1.0-b1/sencha-touch-all.js"></script>


Reply With Quote