Results 1 to 2 of 2

Thread: Adding a list to a panel not working

  1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    5
    Vote Rating
    0
      0  

    Default Unanswered: Adding a list to a panel not working

    In my code, I'm creating an object for a list and a separate object for a panel. When I add the list to the panel using the 'add' method, just the panel gets rendered and the list becomes invisible. And if I comment the code
    Code:
    mainPanel.add(mainList);
    just the list gets rendered and the panel becomes invisible. Same results if I add the list to the 'items' config option of the panel. Am I doing it wrongly than what's given in the official documentation here - http://docs.sencha.com/touch/2-0/#!/...ents-section-6?

    Tested in Chrome 16 and Safari 5.0.3

    Code:
    Ext.application({
        name: 'Sencha',
        launch: InitializeApp
    });
    
    
    function InitializeApp() {
        Ext.define('Contact', {
            extend: 'Ext.data.Model',
            config: {
                fields: ['firstName', 'lastName']
            }
        });
    
    
        var store = Ext.create('Ext.data.Store', {
            model: 'Contact',
            sorters: 'lastName',
            //autoLoad: true,
            grouper: {
                groupFn: function (record) {
                    return record.get('lastName')[0];
                }
            },
    
    
            data: [
               { firstName: 'Tommy', lastName: 'Maintz' },
               { firstName: 'Rob', lastName: 'Dougan' },
               { firstName: 'Ed', lastName: 'Spencer' },
               { firstName: 'Jamie', lastName: 'Avins' },
               { firstName: 'Aaron', lastName: 'Conran' },
               { firstName: 'Dave', lastName: 'Kaneda' },
               { firstName: 'Jacky', lastName: 'Nguyen' },
               { firstName: 'Abraham', lastName: 'Elias' },
               { firstName: 'Jay', lastName: 'Robinson' },
               { firstName: 'Nigel', lastName: 'White' },
               { firstName: 'Don', lastName: 'Griffin' },
               { firstName: 'Nico', lastName: 'Ferrero' },
               { firstName: 'Nicolas', lastName: 'Belmonte' },
               { firstName: 'Jason', lastName: 'Johnston' }
           ]
        });
    
    
        var mainList = Ext.create('Ext.List', {
            //centered: true,
            fullscreen: false,
            width: '300px',
            itemTpl: '<div class="contact">{firstName} <strong>{lastName}</strong></div>',
            store: store,
            grouped: false,
            onItemDisclosure: true
        });
    
    
        var mainPanel = Ext.create('Ext.Panel', {
            fullscreen: true,
            layout: {
                type: 'hbox',
                align: 'middle'
            }
        });
    
    
        mainPanel.add(mainList);
    }

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

    Default

    I see you are using hbox layout for the panel and your list has a width config but no height. The list doesn't know what height to use.
    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
  •