Disco
Disco

Reputation: 4396

Unable to show a listview in sencha touch 2

I'm starting to play around with sencha touch 2 and ran into the following problem. I'm trying to build a very simple application which has a listview and a tabpanel with a button :

I'm seeing the tabpanel with my button and nice title; but the listview refuses to show; i've tried adding 'layout: fit' but it's even worse.

What 'obvious' thing am I missing here ?

Main.js:

Ext.define('CurrencyFX.view.Main', {
extend: 'Ext.Panel',

requires: [
    'CurrencyFX.view.Home',
    'CurrencyFX.view.CurrencyList',
],

config: {

    items: [
        { xtype: 'homecard' },
        { xtype: 'currencycard' },      
    ]
}
});

Home.js:

Ext.define('CurrencyFX.view.Home', {
extend: 'Ext.Panel',
requires: ['Ext.TitleBar'],
xtype: 'homecard',

config: {
    items: [{
        docked: 'top',
        xtype: 'titlebar',
        title: 'Currency FX',
        items: [
            {
                text:    'Refresh',
                align:   'right',
                action:  'reloadQuotes'
            }
        ]
    }
    ]
}
});

CurrencyList.js:

Ext.define('CurrencyFX.view.CurrencyList', {
    extend: 'Ext.List',
    requires: ['CurrencyFX.store.Currencies'],

    xtype: 'currencycard',
    config: {
        itemTpl: '{name} is at {value}',
        store: 'Currencies',
    }
})

Upvotes: 1

Views: 951

Answers (1)

user568866
user568866

Reputation:

Can you add a height to the currencycard? This provides a quick check:

   items: [
            { xtype: 'homecard'},
            { xtype: 'currencycard', height: 500 }
        ]

Here's a layout that will fill the screen (note that I moved docked: 'top' to here!!):

Ext.define('CurrencyFX.view.Main', {
    extend: 'Ext.Panel',

    requires: [
        'CurrencyFX.view.Home',
        'CurrencyFX.view.CurrencyList'
    ],

    config: {
        fullscreen: true,
        layout: 'fit',
        items: [
            {
                xtype: 'homecard',
                docked: 'top'
            },
            { xtype: 'currencycard'}
        ]
    }
});

Upvotes: 2

Related Questions