Results 1 to 4 of 4

Thread: object removed, new object added on mixed collection of items in panel.. not updating

  1. #1
    Sencha Premium Member
    Join Date
    Jun 2008
    Posts
    4

    Default object removed, new object added on mixed collection of items in panel.. not updating

    why when I deleted the object in the "containerPanel"'s items array, does it still appear? How do I refresh the panel to show the newly added object?

    PHP Code:
     
    [LEFT]var middlePanel = new Ext.Panel({
    layout'absolute',
    framefalse,
    border:false,
    height350,
    items:[
    {
    xtype 'panel',
    frame :false,
    border :false,
    0,
    0,
    width :'50%',
    items
    {
    xtype 'combo',
    store: [
    [
    'id1''id1''id1'],
    [
    'id2''id2''id2'],
    [
    'id3''id3''id3']
    ]
    ,
    typeAheadtrue,
    forceSelectiontrue,
    triggerAction'all',
    emptyText:'select...',
    selectOnFocus:true,
    listeners:
    {
    select:
    {
    fn:function(combovalue
    {
    alert(Ext.getCmp('panelContainer').items.getCount());
    Ext.getCmp('panelContainer').items.clear();
    alert(Ext.getCmp('panelContainer').items.getCount());
    Ext.getCmp('panelContainer').items.add(
    'keyv',
    {
    xtype:'label',text:'new obj added?',id:'zzz'}
    );
    }
    }
    }


    }

    },
    {
    xtype'panel',
    id:'panelContainer',
    frame:false,
    border:false,
    x'50%',
    y0,
    width:'50%',
    items
    [
    ({
    xtype:'label',text:'Initial Label'})
    ]
    }
    ][/
    LEFT]

    }); 

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    This doesn't actuall destroy the items.
    Code:
    Ext.getCmp('panelContainer').items.clear();
    You could use:
    Code:
    var container = Ext.getCmp('panelContainer'), item;
    while (item = container.items.first()) {
      container.remove(item);
    }

  3. #3
    Sencha Premium Member
    Join Date
    Jun 2008
    Posts
    4

    Default

    thanks the object is being deleted now.
    Now the only question is why isn't the panel showing the newly added objects?
    PHP Code:
    [LEFT]var container Ext.getCmp('panelContainer'), item;
    alert(container.items.getCount());//:1
    while (item container.items.first()) 
    {
    container.remove(item);
    }
    alert(container.items.getCount());//:0
    container.add({ xtype:'label',text:'new obj added(1)?'});
    container.items.add({ xtype:'label',text:'new obj added(2)?'});
    container.insert(0,{ xtype:'label',text:'new obj added(3)?'});[/LEFT]

    alert(container.items.getCount());//:3 

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    After adding component to a container you need to call:
    Code:
    container.doLayout();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •