PDA

View Full Version : nestedList.doLayout()?!?!



drewying
23 Dec 2010, 3:11 AM
I'm sure this is a simple answer. And as you can probably guess I'm a newbie. :) But I'm about ready to rip my hair out over it. How do I rerender a nestedList after adding items to the store? doLayout() doesn't seem to cut it.

My code:



var MyModel = Ext.regModel('mymodel', {
fields: [
{name: 'id', type: 'int'},
{name: 'name', type: 'string'}
]

});

var listData={name:'My List', id: 0, items: [{name: 'Test 1', id: 1}]};

var store = new Ext.data.TreeStore({
model: 'mymodel',
root:listData,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
root: 'items'
}
}
});

var myNestedList = new Ext.NestedList({
title: 'Menu',
fullscreen: true,
store: store,
displayField: 'name',
})

listData.items.push({name: 'Test 2', id: 2});
listData.items.push({name: 'Test 3', id: 3});
myNestedList.doLayout();

Shouldn't that doLayout() method refresh the list with the new items I've added after the nestedList was initizialized? What am I missing here? That code doesn't work. :(

Thank you! :)

-Drew

gigabo
30 Dec 2010, 11:09 AM
Bump.

I'm also trying to dynamically add items to a NestedList. What's the best way to do this?

Thanks,

Bo

steven000
3 May 2011, 7:56 PM
What is our solution here ?

Steven

drewying
3 May 2011, 8:08 PM
I just ended up destroying and recreating the list when I needed to update it. If there is a better solution I don't know it!

-Drew