且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Sencha触摸嵌套列表无数据

更新时间:2023-02-02 21:36:21

如果要在存储区中提供内联数据,应该不是data属性而不是root?

If you are providing inline data in store shouldn't it be data attribute instead of root?

Ext.define('Test.store.data', {
    extend: 'Ext.data.TreeStore',

    config: {
        model: 'Test.model.data',
        defaultRootProperty: 'items',
        data: {
            items: [
            {
                text: 'Drinks',
                items: [
                    {
                        text: 'Water',
                        items: [
                            { text: 'Still', leaf: true },
                            { text: 'Sparkling', leaf: true }
                        ]
                    },
                    { text: 'Soda', leaf: true }
                ]
            },
            {
                text: 'Snacks',
                items: [
                    { text: 'Nuts', leaf: true },
                    { text: 'Pretzels', leaf: true },
                    { text: 'Wasabi Peas', leaf: true }
                ]
            }
        ]
        }
    }
});