1. #1

    Default Dynamically adding items to Panel

    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 - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,642
    Vote Rating
    582
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Code:
    var map = new Ext.Map();
    panel.add(map);
    panel.doLayout();
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Aug 2010
    Posts
    28
    Vote Rating
    0
    Ourysso is on a distinguished road

      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 - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,642
    Vote Rating
    582
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      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);
            
            
        }
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

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

Thread Participants: 2

Tags for this Thread