Создать простой TreeStore без использования модели - Sencha Touch - PullRequest
1 голос
/ 12 марта 2012

Я пытаюсь создать простой TreeStore без модели, вот что я делаю:

var store = new Ext.data.TreeStore({
    fields: ['name', 'area', 'children'],
    data: {
        name: 'Budget',
        area: 1,
        children: [{
            name: 'Defense',
            area: 0.5,
            children: []
        }, {
            name: 'Education',
            area: 0.3,
            children: []
        }, {
            name: 'Debt',
            area: 0.2,
            children: []
        }]
    }
});

Но я получаю Uncaught TypeError: Cannot call method 'getReader' of undefined, может кто-нибудь сказать мне, что мне не хватает?

Спасибо

1 Ответ

1 голос
/ 13 марта 2012

Необходимо указать, что вы используете прокси в памяти:

var store = new Ext.data.TreeStore({
    fields: ['name', 'area', 'children'],
    data: {
        text: 'Budget',
        area: 1,
        children: [{
            name: 'Defense',
            area: 0.5,
            children: []
        }, {
            name: 'Education',
            area: 0.3,
            children: []
        }, {
            name: 'Debt',
            area: 0.2,
            children: []
        }]
    },
    proxy : 'memory'
});
...