Results 1 to 5 of 5

Thread: new to nestedlist

  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default 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:

    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'));
                        }
                    }
                        
                },
    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:
    songs({"songs":[{"name":"Chereokee Shuffle","key":"A"},{"name":"Goldrush","key":"D"},{"name":"Big Mon","key":"G"}]})
    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 ....

    Thanks, Mark

  2. #2
    Sencha Premium User
    Join Date
    Feb 2012
    Location
    Berne, Switzerland
    Posts
    721
    Vote Rating
    46
      0  

    Default

    why JSONP? and why nestedlist? The data looks rather simple...

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default

    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 ...

  4. #4
    Sencha Premium User
    Join Date
    Feb 2012
    Location
    Berne, Switzerland
    Posts
    721
    Vote Rating
    46
      0  

    Default

    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...

  5. #5
    Sencha User
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •