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
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