Sencha Touch不分组TableView

时间:2014-01-29 23:49:25

标签: sencha-touch

无论如何,我正在尝试做一个简单的分组tableview,它在Sencha中不起作用。它会在不添加分组的情况下显示所有项目。

以下是完整的代码:

Ext.define('MyApp.view.CompletedList', {
    extend: 'Ext.dataview.List',
    alias: 'widget.CompletedList',
    fullscreen:true,
    grouped:true,
    ui:'round',
    requires: [
        'Ext.dataview.List'
    ],
    config:{

        fullscreen:true,
        grouped:true,
        store: {
            fields: ['name', 'league', 'division'],
            sorters: 'name',
            grouper: {
                groupFn: function (item) {
                    return item.get('league') + ' ' + item.get('division');
                }
            },
            data: [
            {
                name: 'Texas',
                league: 'AL',
                division: 'West'
            },
            {
                name: 'Boston',
                league: 'AL',
                division: 'East'
            },
            {
                name: 'California',
                league: 'AL',
                division: 'West'
            },
            {
                name: 'Costa Rica',
                league: 'AL',
                division: 'East'
            },
            {
                name: 'Seattle',
                league: 'AL',
                division: 'East'
            }] 
        },
        itemTpl:'{name}' 
    }
});

以下是截图:

enter image description here

1 个答案:

答案 0 :(得分:1)

代码适用于我(Touch 2.3.x)...你运行“sencha app build”或“sencha ant sass”来更新你的主题和其他资源吗?

Ext.create('Ext.List', {
    fullscreen:true,
    grouped:true,
    store: {
        fields: ['name', 'league', 'division'],
        sorters: 'name',
        grouper: {
            groupFn: function (item) {
                return item.get('league') + ' ' + item.get('division');
            }
        },
        data: [
        {
            name: 'Texas',
            league: 'AL',
            division: 'West'
        },
        {
            name: 'Boston',
            league: 'AL',
            division: 'East'
        },
        {
            name: 'California',
            league: 'AL',
            division: 'West'
        },
        {
            name: 'Costa Rica',
            league: 'AL',
            division: 'East'
        },
        {
            name: 'Seattle',
            league: 'AL',
            division: 'East'
        }] 
    },
    itemTpl:'{name}'
});