1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    139
    Vote Rating
    3
    jeanluca is on a distinguished road

      0  

    Default Ext.dataview.List show empty items

    Hello

    I'm trying to get the example from Ext.dataview.List to work and created one js file with everything in it. The output I get is a list with empty items. So the question is why is it empty ?

    Here is my test script

    Code:
    Ext.define('Contact', {
       extend: 'Ext.data.Model',
       fields: ['firstName', 'lastName']
    });
    
    
    var store = Ext.create('Ext.data.Store', {
       model: 'Contact',
       sorters: 'lastName',
    
    
       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'}
       ],
       proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'users'
            }
        }
    });
    
    
    Ext.application({
        name: 'MyApp',
    
    
        launch: function() {
            Ext.create('Ext.List', {
                    fullscreen: true,
                    itemTpl: '<div class="contact">{firstName} <strong>{lastName}</strong></div>',
                    store: store
            });
        }
    });
    What might be the problem with this code ?

    cheers

    UPDATE: itemTpl should be in the config section

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,582
    Vote Rating
    1136
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    As should the fields:

    Code:
    Ext.define('Contact', {
       extend: 'Ext.data.Model',
    
        config : {
           fields: ['firstName', 'lastName']
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    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.

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Posts
    139
    Vote Rating
    3
    jeanluca is on a distinguished road

      0  

    Default

    ok thnx! BTW this example comes from the docs

Thread Participants: 1