You found a bug! We've classified it as EXTGWT-3005 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    20
    Vote Rating
    0
    strootman is on a distinguished road

      0  

    Default Adding new ContentPanel to AccordionLayoutContainer at runtime issue

    Adding new ContentPanel to AccordionLayoutContainer at runtime issue


    This issue found using GWT 2.5.0 and GXT 3.0.1

    When adding a ContentPanel to an existing, rendered ALC, the ContentPanel is not displayed correctly.
    The expand/collapse button is not displayed.

    This is illustrated in the following entry point example.
    Run the example, click the "Open Example" button, then click the "Add Content panel" button at the bottom of the displayed ALC.
    Observe that the CP is added without the expand/collapse button shown.

    The workaround is simple. Just call ContentPanel.setCollapsible(true) before adding it to the ALC.

    Code:
    package org.example.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.Scheduler;
    import com.google.gwt.core.client.Scheduler.ScheduledCommand;
    import com.google.gwt.event.dom.client.ChangeEvent;
    import com.google.gwt.event.dom.client.ChangeHandler;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.sencha.gxt.widget.core.client.ContentPanel;
    import com.sencha.gxt.widget.core.client.Window;
    import com.sencha.gxt.widget.core.client.button.ButtonBar;
    import com.sencha.gxt.widget.core.client.button.TextButton;
    import com.sencha.gxt.widget.core.client.container.AccordionLayoutContainer;
    import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
    import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
    import com.sencha.gxt.widget.core.client.event.SelectEvent;
    import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
    import com.sencha.gxt.widget.core.client.form.CheckBox;
    import com.sencha.gxt.widget.core.client.form.FieldLabel;
    import com.sencha.gxt.widget.core.client.form.TextField;
    
    public class ExampleEntryPoint implements EntryPoint {
    
        @Override
        public void onModuleLoad() {
            // Create Field Labels and text fields
            final TextField tf1 = new TextField();
            tf1.setAllowBlank(false);
            FieldLabel fl1 = new FieldLabel(tf1, "Text Field 1:");
    
            final TextField tf2 = new TextField();
            tf2.setAllowBlank(false);
            FieldLabel fl2 = new FieldLabel(tf2, "Text Field 2:");
            final TextField tf3 = new TextField();
            tf3.setAllowBlank(false);
            FieldLabel fl3 = new FieldLabel(tf3, "Text Field 3:");
    
            // Create VLCs for the Accordion ContentPanels
            VerticalLayoutContainer vlc1 = new VerticalLayoutContainer();
            vlc1.add(fl1, new VerticalLayoutData(1, -1));
    
            VerticalLayoutContainer vlc2 = new VerticalLayoutContainer();
            vlc2.add(fl2, new VerticalLayoutData(1, -1));
            vlc2.add(fl3, new VerticalLayoutData(1, -1));
    
            CheckBox cb1 = new CheckBox();
            cb1.setBoxLabel("Sample Checkbox");
            vlc2.add(cb1);
    
            ContentPanel cp1 = new ContentPanel();
            cp1.add(vlc1);
            ContentPanel cp2 = new ContentPanel();
            cp2.add(vlc2);
    
            final AccordionLayoutContainer alc = new AccordionLayoutContainer();
            alc.add(cp1);
            alc.add(cp2);
            alc.setActiveWidget(cp1);
    
            TextButton validateButton = new TextButton("Add Content panel");
            validateButton.addSelectHandler(new SelectHandler() {
    
                @Override
                public void onSelect(SelectEvent event) {
                    alc.add(new ContentPanel());
                }
            });
            ButtonBar bBar = new ButtonBar();
            bBar.add(validateButton);
    
            final VerticalLayoutContainer vlc = new VerticalLayoutContainer();
            vlc.add(alc, new VerticalLayoutData(1, 1));
            vlc.add(bBar, new VerticalLayoutData(1, -1));
    
            TextButton openExampleButton = new TextButton("Open Example");
            openExampleButton.addSelectHandler(new SelectHandler() {
    
                @Override
                public void onSelect(SelectEvent event) {
                    Window w = new Window();
                    w.setSize("400", "400");
                    w.add(vlc);
                    w.show();
                }
            });
    
            RootPanel.get().add(openExampleButton);
    
        }
    
    }
    Last edited by strootman; 16 Apr 2013 at 3:28 PM. Reason: removed unnecessary handler, for clarity.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Jan 2012
    Location
    Arlington, WA
    Posts
    364
    Vote Rating
    14
    branflake2267 will become famous soon enough

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

    I have confirmed the exception exists when adding content panel to ACL.

    We will update this thread once we make some progress on it.

Thread Participants: 1

Tags for this Thread