-
21 Jun 2012 3:05 PM #1
Unanswered: ext-record-# on list for empty server response
Unanswered: ext-record-# on list for empty server response
Hi all,
I have a couple issues that I found both somewhat related.
First one: I make a list and do a manual ajax request (Ext.Ajax.request) to get data. If the json response gives [] and I pass that to the list's data config, it will give a reader error. I can fix this by passing it null if the array is empty. Any ideas why this is?
Second one: I make a list that is backed by a store. My store is configured with an ajax proxy and json reader. I do something like view.down('list').getStore().load(). If the json response gives anything, it works great. If it gives the empty array response (like above), it puts an "ext-record-#" as the only item in my list. Any suggestions?
Thanks in advance.
-
24 Jun 2012 1:54 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
Do you have an id field configured or any value returning in the id property?
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.
-
24 Jun 2012 1:56 PM #3
yes, I never go without an idProperty (learned that the hard way with Ext).
Also for further clarification, my default empty json response looks like this:
{success:"true", total: 0, payload:[]}
And both issues in my original problem are not issues when there is data in the payload. e.g.:
{success:"true", total: 0, payload:[{something:"blah", id:1},{something:"blah 2", id:2}]}
-
28 Jun 2012 7:18 AM #4
Similar issue
Similar issue
I am having a similar issue. I am attempting to reach out to Flickr and pull in 5 images. At this point I am just trying to display the data instead of using an xtemplate, just to ensure it's working.
This list is part of a carousel container.
Any help would be greatly appreciated!Code:xtype: 'list', items: { xtype: 'toolbar', docked: 'top', title: 'Flickr' }, store: { model: 'app.model.flickr', autoLoad: true, storeId: 'flickr', proxy: { type: 'ajax', url: 'http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key=MY_API_KEY&user_id=38799934%40N02&safe_search=1&per_page=5&format=json&nojsoncallback=176029f1357a0f0e19811cbf094e253ac', reader: { type: 'json', rootProperty: 'photos' }, fields: [ { name: 'id' }, { name: 'user' } ] } }, itemTpl: '<div>{id}{user}</div>'
Thanks


Reply With Quote