Hi, today I tried using Accordion component but it seems like it does not allow me to use it with no items in it. My original idea was to have user create item instances in Accordion and then save it. For displaying this I will run query and populate the accordion with item instances.
If I delete the default item that comes with the Accordion in designer, it seems to be fine with it. But in the Perspective session, there is a header that cannot be expanded.
You could create your own accordion using a flex repeater and some CSS transitions.
For the view you put in the flex repeater:
Give it a header container with a set basis and 0 grow/shrink. Then give it another container or embedded view for the content, with a basis of auto, 0 grow/shrink, and in the styles add a max-height of 0 and a transition of max-height 0.3s ease-in-out.
Add an on-click event to the header container that sends a message with the value for view.params.index and receive it on the root or somewhere in the same view. That message handler should update the content container's max-height to 9999 only if the index received in the payload matches the index in the view.params, otherwise set the content's max-height back to 0.
That should yield the same effect as the accordion as you add them to a flex repeater. Make sure you set the instance basis to auto as well.
Hi,
You can create a default view inserted by a script on the "items" accordion property to avoid this behaviour. But it doen't remove the header.
If you really want to remove the header, the only way I found is to set the CSS property "display" to "none" for the header.
You can do this with this code in the "stylesheet.css" in style folder (you can show it with the right click on the "style" folder), and then apply the CSS class "hideAccordionHeader" on the accordion.
Note: It will remove all header for this accordion, remove the class when there is at least one item. For that you can use a binding on the class property and use an expression like that.
Hi Daniel, I actually did that before discovering that there is actually a component for that in Ignition. I wanted to get rid of extra complexity and use what is available.
Hi Steve, I have to investigate the Ignition's stylesheet.css. I would like to keep the settings default so I can distribute the project to non modified gateways as well.
Steven, this helped us quite a bit. I was wondering, could you take it a step further and also hide all the borders around the component and the border between accordions? We want to utilize this component as a way to essentially bring in "dynamic" components by passing a list of embedded views to display when a page loads.