-
20 Aug 2011 2:32 AM #1
Unanswered: Ext.Model can't get data from remote server
Unanswered: Ext.Model can't get data from remote server
this is my code:
remote server response text is :Code:Ext.regModel('UserTask', { fields: ['ret_code', 'ret_desc'], proxy:{ type:'ajax', url: 'http://localhost/api.php', reader: 'json' }, }); var user3=Ext.ModelMgr.getModel('UserTask'); user3.load(null, { success: function(record, operation) { console.log(record); console.log(operation); } });
{"ret_code":"SUCC","ret_desc":"","task":"abc"}
the result return is :
record is undefined
-
20 Aug 2011 8:59 AM #2
I dont see any store in your code, you need a model and store, you are mixing model and store param in your model definition...
-
20 Aug 2011 7:18 PM #3
thanks your reply
store is multiple Model.
i just want to load one record to Model, not a store
i read the docs api (http://dev.sencha.com/deploy/touch/docs/), the example code in "Using Proxy" can resolve my question, but do not work.
-
20 Aug 2011 7:20 PM #4
-
22 Aug 2011 5:05 AM #5Sencha - Services Team
- Join Date
- Mar 2007
- Location
- Foristell, MO
- Posts
- 1,100
- Vote Rating
- 3
- Answers
- 12
The issue is with your server's response. When you load data into a store the data needs to be an Array of whatever you are loading. So if you are loading in Json, you need an array of json objects. So just wrap your response in square brackets and then your code will work.
Jack Ratcliff
Sencha Inc, Green bleeding Senchan
How to report a bug:
http://www.sencha.com/forum/showthre...o-report-a-bug


Reply With Quote