Results 1 to 4 of 4

Thread: Dynamically adding items to Panel

  1. #1

    Default Dynamically adding items to Panel

    Hi all,
    I just wanted to know, how can I add items dynamically (using code) in a panel. My panel is already created and has a toolbar in it. Once I click on a button inside toolbar, I want to add map inside the panel.
    Thanks.
    Windows Mobile, Windows Phone Specialist | Beginner Android, iPhone Developer
    http://www.mayurtendulkar.com

  2. #2
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,968
    Vote Rating
    931
      0  

    Default

    Code:
    var map = new Ext.Map();
    panel.add(map);
    panel.doLayout();
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha User
    Join Date
    Aug 2010
    Posts
    28
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by evant View Post
    Code:
    var map = new Ext.Map();
    panel.add(map);
    panel.doLayout();
    Didn't Work. ;P
    I tried it:
    var painel = new Telasistema.agendaSalasPanel();
    Ext.getCmp('painel_conteudo').add(painel);
    Ext.getCmp('painel_conteudo').doLayout();

    What am I doing wrong?

  4. #4
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,968
    Vote Rating
    931
      0  

    Default

    It does work, however you haven't provided any context at all so I can't say.

    Code:
    Ext.setup({
        tabletStartupScreen: 'tablet_startup.png',
        phoneStartupScreen: 'phone_startup.png',
        icon: 'icon.png',
        glossOnIcon: false,
        onReady : function() {
            var p = new Ext.Panel({
                fullscreen: true,
                layout: 'fit'
            });
            
            setTimeout(function(){
                p.add(new Ext.Panel({
                    html: 'Foo'
                }));
                p.doLayout();    
            }, 2000);
            
            
        }
    });
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Similar Threads

  1. Auto adjust panel height after dynamically adding items
    By markalroberts in forum Ext 3.x: Help & Discussion
    Replies: 9
    Last Post: 1 Jul 2014, 4:50 AM
  2. Dynamically adding new items to Carousel
    By kostik83 in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 9 Jul 2010, 6:54 AM
  3. dynamically adding panel items
    By sk205 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 21 May 2008, 11:20 AM
  4. Adding dynamically items within menu
    By Freud in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 18 Apr 2008, 2:24 AM

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
  •