Results 1 to 2 of 2

Thread: Using getDetailCard() for List just like a NestedList

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

    Default Unanswered: Using getDetailCard() for List just like a NestedList

    Hi all,

    I'm trying Sencha 2.0 for the first time for a non-profit, and have been able to figure out most of what I need to do with the examples, however I am stuck on 1 point which I hope someone can help:

    I am trying to use the getDetailCard() simple functionality with a List but apparently that only works with Nested Lists.

    The app will have a news feed and events feed which work well with Nested Lists, but I would like to use a List for a list of organization's members with the grouping and so on. When you tap on the name of the person, it displays the name/address in a sliding panel with a Back button.

    I looked all over and couldn't find code that supports this except for the O'Reilly example which I cannot understand with all of the different files and code all over the place.

    Is there a way to easily replicate the cleanliness and ease of use of getDetailCard() for a list?

    Code:
            items: [
                {    
                    title: 'Home',
                    iconCls: 'home',
                    cls: 'home',
                    html: [
                        '<h1>Welcome to MobileApp Mobile</h1>',
                        "<p>You're creating the Getting Started app. This demonstrates how ",
                        "to use tabs, lists and forms to create a simple app</p>",
                        '<h2>Sencha Touch 2</h2>'
                    ].join("")
                },
                {
                    xtype: 'nestedlist',
                    title: 'News',
                    iconCls: 'star',
                    displayField: 'title',
    
    
                    store: {
                        type: 'tree',
    
    
                        fields: [
                            'title', 'link', 'author', 'contentSnippet', 'content', 
                            {name: 'leaf', defaultValue: true}
                        ],
    
    
                        root: {
                            leaf: false
                        },
    
    
                        proxy: {
                            type: 'jsonp',
                            url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&q=http://rss.cbc.ca/lineup/canada.xml',
                            reader: {
                                type: 'json',
                                rootProperty: 'responseData.feed.entries'
                            }
                        }
                    },
    
    
                    detailCard: {
                        xtype: 'panel',
                        scrollable: true,
                        styleHtmlContent: true
                    },
    
    
                    listeners: {
                        itemtap: function(nestedList, list, index, element, post) {
                            this.getDetailCard().setHtml(post.get('content'));
                        }
                    }
                },
                //this is the new item
                {
                    title: 'Directory',
                    iconCls: 'team',
                    cls: 'home',
                    displayField: 'title',
                    xtype: 'list',
                    layout: 'fit',
                    store: MemberStore,
                    itemTpl: '<div class="contact"><strong>{lastName}</strong>, {firstName}</div>',
                        grouped: true,
                        indexBar: true,
    
    
                    detailCard: { // This doesn't seem to work in Lists
                        xtype: 'panel',
                        scrollable: true,
                        styleHtmlContent: true
                    },
    
    
                    listeners: {
                       
                      itemtap: function(list, index, element, post) {
                          alert('tapped - ' && post.get('firstName'));
                          //this.getDetailCard().setHtml(post.get('firstName')); //-- This line will never work in "list" // only nestedList
                      }
                    }
                }
            ]
        });
    Thanks!

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,336
    Answers
    3885
    Vote Rating
    1296
      0  

    Default

    Wrap the list in a container that is using card layout. First item is the list and second item is a component or container that is your "detailCard"
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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 in print!

    When posting code, please use BBCode's CODE tags.

Tags for this Thread

Posting Permissions

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