Have a doubt with accordion?

0
So I am using accordion to display 7 quantities. If I open one quantity the already opened quantity should be closed. Is it possible to implement that in accordion without any microflows?
asked
2 answers
0

Hi,


Yes, this is possible and you do not need a microflow for this. The behavior you are describing is the standard Accordion behavior called “single expand mode” (only one section open at a time).

In Mendix this depends on the Accordion widget configuration.

Correct configuration

Open the Accordion widget properties and enable the option:

Expand mode / Multiple expansion

Set it like this:

Multiple expansion = No

(or depending on the widget version it may appear as "Allow multiple panels open" = false).

What this does

When Multiple expansion = No:

  • Opening one accordion section automatically closes the previously opened section.
  • Only one panel can stay expanded at a time.
  • No microflow or JavaScript is required.

Example behavior

You have 7 sections:

Quantity 1
Quantity 2
Quantity 3
Quantity 4
Quantity 5
Quantity 6
Quantity 7

If the user opens:

Quantity 3

and then clicks

Quantity 5

Mendix will automatically:

Close Quantity 3
Open Quantity 5

If you are using the Atlas Accordion

This setting is available directly in the widget properties:

Accordion
   └─ Multiple expanded = No

When a microflow is needed

A microflow is only required if you want custom logic, such as:

  • remembering which section was opened previously
  • controlling accordion state from data
  • opening a section automatically

For the standard “open one, close others” behavior, configuration alone is enough.

So simply disable Multiple expansion and the accordion will behave exactly as you described.

answered
0

If these are not part of the same accordion widget, then this behavior is not possible automatically.


The open one close the others behavior usually works only when all sections are inside the same accordion component that supports single open mode.


If you currently have seven separate accordions or containers each one controls its own state so opening one will not close the others.


Your options would be to place all quantities inside a single accordion widget that supports one panel open at a time or implement custom logic such as a nanoflow microflow or custom widget.


If this resolves your issue, please mark the answer as accepted so it can help others in the community as well.

answered