Accordion component

How can i let the accordion component stay opened when i click on it? It’s showing shortly for less than one second opened and then closing directly.

Thanks

I’ve found a solution.
You need to open the accordion component in component template editor and go to it’s logic. There you have to change the delay.

But maybe anyone has a solution for it to stay opened, without changing the delay?
Problem is that also the get record collection is bound to this delay.

Hi @friendly424234, the component has been improved and there’s an update coming up real soon where you can control 1) if the component refreshes the data at all 2) how often the data is fetched.

Additionally the logic that currently makes it go back to the initial state when data refreshes has been fixed, so the status should stay the same even if the data refreshes.

@friendly424234 the update is now live, try updating your Accordion :slight_smile:

This worked. Perfekt!
Thanks :+1:

1 Like

Now i have a new problem :see_no_evil:
If i create a new entry oder delete one, it isn’t shown in the list (or deleted from it) until i restart the app or save changes in composer pro.
→ So it does not longer refresh it’s entries. How can i fix this?

Hi @friendly424234, do you have the “Refresh data” option set to true?

Where can i find it?

On the Properties tab:

I needed to reset the component to default. I changed and added a few things.
Now Refresh data works, but again it closes after a few seconds. (The first one at the top stays opend, but the rest didn’t)
Maybe you can look into my App?
App: 335060

Hi, do you have the latest version of the component installed? Which preview version and platform is this happening on? I can’t get the issue to reproduce.

The marketplace says the latest version is installed.
The preview App is on Runtime Version 3.4.4 and Parser Version 8.0.2.
Previously i changed a few things on this component, then your update came out and i had to reset it to the latest update and then i again changed a few things in there to have my needed function.
E.g. i added a icon for entry deletion and i also added an entry to get more information into it. Cause of that i changed sth in accordion logic. (I changed set private vars formula a bit - at the top right)

Okay, in the node where collapseStatus is set, the formula should be:

MAP(privateDataVars.items, IS_IN_ARRAY_BY_KEY(privateVars.collapseStatus, "content", item.content) ? SET_KEY(item, "isCollapsed", FIND_BY_KEY(privateVars.collapseStatus, "content", item.content).isCollapsed) : {content: item.content, title: item.title, isCollapsed: internalProps.initialCollapse})

This formula keeps the collapse status as is for items that are already in the list, and if there are new items, it sets them to the initialCollapse value defined by you.

This is my formula:

MAP(privateDataVars.items, IS_IN_ARRAY_BY_KEY(privateVars.collapseStatus, "content", item.content) ? SET_KEY(item, "isCollapsed", FIND_BY_KEY(privateVars.collapseStatus, "content", item.content).isCollapsed) : {content: item.content, title: item.title, id: item.id, value: item.value, isCollapsed: internalProps.initialCollapse})

I added id and value and if i try to use your formula without these two i’ve added, it says that list items are incompatible.

Okay, that shouldn’t break things :thinking: have you updated both the data resource adapter and collapseStatus private variable to match your new schema?

yes, i think so.
I’ve set the private vars and i changed the data property

Hi, then you’ll need to determine at what point the component logic is failing because of the changes. What I would do to debug this is to add an extra text inside the component and bind it to privateVars.collapseStatus. By doing this, you can see what the variable contains and at what point it starts misbehaving and how.

Another possibility – the formula uses the content field to determine the collapse status. If these are not unique or if some of them are empty, it could cause an issue :thinking:

Don’t know why, but after i switched the output from the refresh rate if condition it’s now working. :see_no_evil:

But… The data isn’t refreshing. Only if I reopen the app, the new or deleted data is added or removed

Can you post a screenshot of how the logic looks like now? The data should be refreshing if the “Delay” node is attached properly to “Get record collection” (if refresh data is set to true, wait for a delay, then Get record collection again).