1. #1
    Sencha User
    Join Date
    Jun 2010
    Vote Rating
    meyerovb is on a distinguished road


    Default Dynamically add an item to a list

    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?

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Haarlem, Netherlands
    Vote Rating
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough



    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.

Similar Threads

  1. Add tab item dynamically
    By wwwjsx in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 24 Oct 2009, 1:18 AM
  2. add item not in combobox list
    By iceblast_01 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 4 Dec 2008, 8:21 PM
  3. how to add componets dynamically to items list of Accordian
    By rao in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 29 Aug 2008, 9:36 PM
  4. Add toolbar item dynamically?
    By TopKatz in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 3 Apr 2007, 12:04 PM

Thread Participants: 1