1. #1
    Ext User
    Join Date
    May 2009
    Posts
    7
    Vote Rating
    0
    jobe451 is on a distinguished road

      0  

    Default Adding content to a container after it was rendered

    Adding content to a container after it was rendered


    Hi

    I try to write a simple website using GXT. It should have a top horizontal menu in one rowlayout-container, below there should be a second row layout container with the actual content. Depending on the menu-entry one clicks the content below should change. So the look and feel should be quite similar to the Ext Js site for instance.

    I succeeded in writing most of it (menu, content cotainers, buttons, event handlers...). However, I do not manage to get the content in the content container change once the a menu item is clicked.

    The way I try to update the content below is by removing the current content and adding the new content.

    I tried to summarize my problem in a few lines of sample code. The code below shows two buttons. The "remove it" button, successfully removes the current content from the page. The "add it" button however executes without error, but nothing changes on the page.

    Why is it, that this widget get's actually added but it is not shown on the page. I is there a way to make this happening or did I choose 'the wrong way'?

    Code:
    public class test implements EntryPoint {
        
        public void onModuleLoad() {
    
            Viewport myWindow = new Viewport();
            myWindow.setLayout(new RowLayout());
            
            final LayoutContainer c1 = new LayoutContainer(new RowLayout(Orientation.HORIZONTAL));
            final Text t1 = new Text("Home: Lorem ipsum dolorem.");
            final Text t2 = new Text("Details: Lorem ipsum dolorem.");
    
            Button b1 = new Button("add it");  
            b1.addSelectionListener(new SelectionListener<ButtonEvent>() {  
                public void componentSelected(ButtonEvent ce) {  
                    c1.add(t2);
                }  
            });          
    
            Button b2 = new Button("remove it");  
            b2.addSelectionListener(new SelectionListener<ButtonEvent>() {  
                public void componentSelected(ButtonEvent ce) {  
                    c1.remove(t1);
                }  
            });          
    
            c1.add(t1);
            myWindow.add(c1);
            myWindow.add(b1);
            myWindow.add(b2);
            
            RootPanel.get().add(myWindow);    
        }
    }

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    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


    Code:
    Button b1 = new Button("add it");  
            b1.addSelectionListener(new SelectionListener<ButtonEvent>() {  
                public void componentSelected(ButtonEvent ce) {  
                    c1.add(t2);
    c1.layout();
                }  
            });

  3. #3
    Ext User
    Join Date
    May 2009
    Posts
    7
    Vote Rating
    0
    jobe451 is on a distinguished road

      0  

    Default


    THANKS !!!!

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar