Results 1 to 2 of 2

Thread: Panel.add or Panel.insert not working

  1. #1

    Default Answered: Panel.add or Panel.insert not working

    Hello everybody..

    I cant add a new object in my panel,.. Could someone help me please? ..
    I lost many hours trying this..
    The code:

    Code:
    me.painelCentral = Ext.create('Ext.panel.Panel', 
            {
                renderTo: Ext.getBody(),
                height: window.innerHeight - 142,
                layout: 'anchor',
                items:
                [
                    Ext.create('Ext.button.Button',
                    {
                        text: 'AAA',
                        handler: function()
                        {
                            console.log('D');
                            me.painelCentral.add(Ext.create('Ext.button.Button',
                                {text: 'BBB', width: 200,renderTo: Ext.getBody(),}
                            ));
                        }
                    })
                ]
            });

    1. Only the outer-most container should have renderTo - remove it from the button.
    2. Get rid of the Ext.create calls for items, just pass configs with suitable xtypes. What you're doing should work but it's not idiomatically correct.
    3. Make sure you've got your layouts configured correctly. The item may be added but you might not be able to see it if the layouts are wrong. You can inspect the DOM to confirm whether the elements are rendered.


    If none of that fixes it I suggest posting a Fiddle, assuming you can reproduce the problem in a version that Fiddle supports.

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

    Default

    1. Only the outer-most container should have renderTo - remove it from the button.
    2. Get rid of the Ext.create calls for items, just pass configs with suitable xtypes. What you're doing should work but it's not idiomatically correct.
    3. Make sure you've got your layouts configured correctly. The item may be added but you might not be able to see it if the layouts are wrong. You can inspect the DOM to confirm whether the elements are rendered.


    If none of that fixes it I suggest posting a Fiddle, assuming you can reproduce the problem in a version that Fiddle supports.

Similar Threads

  1. Method insert of a panel not working
    By Tioecomp in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 28 Dec 2012, 8:58 AM
  2. Replies: 2
    Last Post: 13 Mar 2012, 4:35 AM
  3. How do you insert Ext.Panel into DOM?
    By IvanJ in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 17 May 2011, 8:13 PM
  4. Panel insert
    By t-1000 in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 22 Sep 2010, 4:37 AM
  5. How can I insert ComboBox into Panel?
    By zhouguoguang in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 14 Dec 2008, 6:37 PM

Tags for this Thread

Posting Permissions

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