1. #1
    Sencha User
    Join Date
    Aug 2010
    Posts
    35
    Vote Rating
    0
    Alona Oz is on a distinguished road

      0  

    Default Adding elements dynamicly to LayoutContainer

    Adding elements dynamicly to LayoutContainer


    There is something that I probably don't understand. I try to create a vertical layout container and add elements to it on button click. But this doesn't work, the elements are not drawn. What is the problem?

    Also when I try to add Label element instead of Button, it draws them in one horizontal line instead of putting them vertically.

    Code:
    public class MYTest implements EntryPoint {
        public void onModuleLoad() {
            final LayoutContainer postsContainer = new LayoutContainer();
            VBoxLayout layout = new VBoxLayout();
            layout.setPadding(new Padding(5));
            layout.setVBoxLayoutAlign(VBoxLayout.VBoxLayoutAlign.LEFT);
            postsContainer.setLayout(layout);
     
            Button b = new Button("add new element");
            b.addListener(Events.OnClick,new Listener<ButtonEvent>() {
                public void handleEvent(ButtonEvent buttonEvent) {
                    postsContainer.add(new Button("New Label"));
                }
            });
     
            postsContainer.add(b);
            postsContainer.add(new Button("New Label"), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
            postsContainer.add(new Button("New Label2"), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
     
            Viewport viewport = new Viewport();
            viewport.setLayout(new FitLayout());
            viewport.add(postsContainer);
            RootPanel.get().add(viewport);
        }

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    After modifying a container, you need to call layout on it.

  3. #3
    Ext User
    Join Date
    Oct 2010
    Posts
    18
    Vote Rating
    0
    ikovaltaras is on a distinguished road

      0  

    Default


    @sven layout() and even layout(true) will not help, this is the same issue that I have posted about.

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Works fine for me. I just run it against latest SVN.

  5. #5
    Ext User
    Join Date
    Oct 2010
    Posts
    18
    Vote Rating
    0
    ikovaltaras is on a distinguished road

      0  

    Default


    i not tried with svn version, i have 2.2.0

  6. #6
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    This should run against 2.2.0 final too.

Similar Threads

  1. Dynamicly injecting elements into the head
    By ReSpawNnL in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 11 Jun 2010, 3:28 AM
  2. Adding and removing form elements
    By Northie in forum Ext 3.x: Help & Discussion
    Replies: 11
    Last Post: 7 Dec 2009, 6:35 AM
  3. Dynamicly Adding Tabs Question
    By netnutmike in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 17 Nov 2008, 9:55 AM
  4. Adding elements to a panel
    By swamyveera in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 22 Mar 2008, 3:08 AM
  5. Adding elements to PagingToolbar
    By josh in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 21 Jun 2007, 10:23 AM

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."