Results 1 to 2 of 2

Thread: How to stop expanding accordion? I mean how to cancel expand event?

  1. #1
    Sencha User
    Join Date
    Nov 2010
    Vote Rating

    Default How to stop expanding accordion? I mean how to cancel expand event?

    I am using ExtGwt. i have below code.

    private ContentPanel mainPanel = new ContentPanel();
    private ContentPanel firstAccordion = new ContentPanel();
    private ContentPanel secondAccordion = new ContentPanel();
    private ContentPanel thirdAccordion = new ContentPanel();
    i have accordionlayout set. i have 3 accordions. all are added to mainPanel. when user is viewing secondAccordion, if user clicks on first accordion then first accordion should not be expanded. user should be retained in seconAccordion itself. so, my question is, i have certain condition when to retain the user in the same accordion where he is. if user clicks on any other accordions, then i should stop expandint the other accordion. how can i do that? Please help me.


  2. #2
    Sencha User WesleyMoy's Avatar
    Join Date
    Oct 2009
    Redwood City, California
    Vote Rating


    You can subclass AccordionPanel and override onBeforeExpand. You can tell which content panel is active by checking which one is expanded. You can tell which content panel the user has tried to select with ComponentEvent.getComponent.

    If you don't call super.onBeforeExpand in turn, you will prevent changing which content panel is active.

    Here's a quick example with an anonymous inner class subclassing AccordionLayout.

    new AccordionLayout() {
     protected void onBeforeExpand(ComponentEvent ce) {
       if (ce.getComponent() != firstAccordion) {
    You can substitute the if-condition with any other logic you like, including checking for the currently active panel.

Tags for this Thread

Posting Permissions

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