Results 1 to 3 of 3

Thread: Adding multiple elements to the accordion layout

  1. #1
    Sencha Premium Member
    Join Date
    Jun 2013
    Location
    Nuremberg, Germany
    Posts
    88
    Answers
    3

    Default Adding multiple elements to the accordion layout

    Hi there,
    I am implementing the gxt (3.0.7) accordion layout at the moment.
    For that, I have checked out the example on the gxt site (http://www.sencha.com/examples/#Exam...ccordionlayout).

    I wanted to add more than one element to the content panel that is child of the AccordionLayoutContainer. This doesn't work, because the container can only have one single element. The add method removes this element before adding the new one. That means, the add method does not actually add, but replace the existing element.
    If I want to have more than one element, I have to put another FlowLayoutContainer into the ContentPanel that is placed in the AccordionLayoutContainer.

    Is there a possibility to add multiple elements directly to the content panel?

    Thanks for your help!
    Holger

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Location
    Germany
    Posts
    223
    Answers
    5

    Default

    Quote Originally Posted by Holger Herrmann View Post
    Is there a possibility to add multiple elements directly to the content panel?
    No, it isn't. ContentPanel extends SimpleContainer. And SimpleContainer implements HasOneWidget. For these Classes add(child) is equal to setWidget(child).

    But you can do this: add a widget to the Contentpanel, which can carry multiple children like FlowLayoutContainer, VerticalLayoutContainer or HBoxLayoutContainer.

    Example:
    Code:
    accordion
        \-- cp1
              \-- flc
                    \-- child1
                    \-- child2
                    \-- child3
        \-- cp2
              \-- label
        \-- cp3
              \-- other

  3. #3
    Sencha Premium Member
    Join Date
    Jun 2013
    Location
    Nuremberg, Germany
    Posts
    88
    Answers
    3

    Default

    Hi Andreas,

    thank you for your answer.
    Yes, adding a FlowLayoutContainer is exactly what I do:
    If I want to have more than one element, I have to put another FlowLayoutContainer into the ContentPanel that is placed in the AccordionLayoutContainer.
    I wondered why it's implemented this way as I suppose adding more than one widget should be the usual case.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •