-
12 Nov 2012 1:41 PM #1
new to nestedlist
new to nestedlist
I'm trying to alter the getting started app by supplying my own json feed. But I'm having trouble getting it to show up in the list.
Here's my code:
Here's my json being returned. Now I'm not really sure if my json is correct ( ivalidated the raw json) but I'm unclear how to make it jsonp, so I just wrapped it in a song() function:Code:launch: function() { Ext.create("Ext.tab.Panel", { fullscreen: true, tabBarPosition: 'bottom', items: [ { xtype: 'nestedlist', title: 'Songs', iconCls: 'star', displayField: 'name', store: { type: 'tree', fields: [ 'name'], root: { leaf: false }, proxy: { type: 'jsonp', url: 'http://phpfakebook.com/songs/get_songs', reader: { type: 'json', rootProperty: 'songs' } } }, detailCard: { xtype: 'panel', scrollable: true, styleHtmlContent: true }, listeners: { itemtap: function(nestedList, list, index, element, post) { this.getDetailCard().setHtml(post.get('content')); } } },
The feed from the sencha blog doesn't seem to have it's code wrapped in any function, i've tried it both ways but unable to get it to work. I'm sure it's something super simple ....Code:songs({"songs":[{"name":"Chereokee Shuffle","key":"A"},{"name":"Goldrush","key":"D"},{"name":"Big Mon","key":"G"}]})
Thanks, Mark
-
13 Nov 2012 1:54 AM #2
why JSONP? and why nestedlist? The data looks rather simple...
-
13 Nov 2012 10:54 AM #3
It's mostly because I was just trying to futz with the getting started app. Start with something that's working and see if you can slowly change it to something you want to do.
Beyond that, at some point the app will go out and grab new data from a web service, which is why I was using jsonp.
As to nested list, again it was just because that's what the getting started app was using and I had that working. I would like to use a detail pane when I get farther down the road, but I'm guessing I can do that with a regular list too ...
-
13 Nov 2012 11:31 AM #4
I'm just asking because JSONP and nestedlists probably may make the initial learning curve a bit steep .. So you better start with something easier. Just my 2 cents.
And BTW you can retrieve data with normal JSON too...
-
13 Nov 2012 11:49 AM #5
I was curious in the getting stared example, the request type says jsonp, but it doesn't look like the data from the sencha blog is actually jsonp.


Reply With Quote