Bubba88
Bubba88

Reputation: 1920

How to update the Nested List/Tree Store in Sencha Touch?

I have a nested list which must be filled with new data based on what does user select in an Ext.Carousel.

TreeStore.load(newData) // this does not work :(
TreeStore.removeAll() // this works!

It seems that the docs and the forum don't have the answer, cause I have been searching for 2-3 days. Thank you in advance.

Upvotes: 3

Views: 5318

Answers (2)

Bubba88
Bubba88

Reputation: 1920

I've ended up with following solution:

NestedList = Ext.extend(Ext.NestedList, {
    loadData: function(data) {
        this.store.setProxy({
            type:'memory',
            data: data,
            reader: {
                type: 'tree',
                root: 'items'
            }
        });
        this.store.load();
        { // some back taps to make it show the top level
            this.onBackTap();         
            this.onBackTap();         
            this.onBackTap(); }; 
},

Upvotes: 4

jrboddie
jrboddie

Reputation: 161

I believe you are correct. To load new data, try this:

TreeStore.removeAll();
TreeStore.add(newData);

Upvotes: -3

Related Questions