View Full Version : Dynamically add an item to a list

30 Jun 2010, 8:21 PM
This works:

Ext.setup({onReady: function () {
var e = new Ext.Panel({ fullscreen: true, items: [{ html: 'a' }, { html: 'b'}] });
e.add({ html: 'c' });

Change it to an Ext.List and it blows up in the DataView's refresh method on the following line because 'this.store' is undefined:
if (this.store.getRange().length < 1 && (!this.deferEmptyText || this.hasSkippedEmptyText)) {

What's the appropriate way to dynamically add items to a list?

1 Jul 2010, 11:33 AM
List is not something that you can add components to. A list is always backed by a store. You can check the source code for our list example to see how to use it.

Once you have your list with store setup you can easily add items by just adding a new record to the store.