46
Views
6
Comments
Solved
[OutSystems UI] I would like to use on click actions in a Accordion title
outsystems-ui
Reactive icon
Forge component by Gonçalo Martins
Application Type
Reactive

Hi,

I would like to use a checkbox and an icon with onClick screen actions in the title of the Accordion component, without the Accordion collapsing or expanding. It would be nice if the Accordion only toggled on the angle up icon that is already provided inside the Accordion title.

I have already tried to use the AccordionItemAllowTitleEvents and I tried to use a Javascript node with e.stopPropagation() to stop the toggling of the accordion. This worked for the toggle but it prevented my actions from working as well. 

I hope somebody can help me with this problem.

Kind regards, 

Dean


Screenshot 2023-11-16 at 09.12.51.png
Solution

Hello @Dean Stavenuiter 

I might be missing something but using the client action AccordionItemAllowTitleEvents in the initialize event of the AccordionItem block does the trick as expected.
I just did a quick test based on the image you shared and it worked.

  • First, use the event:
  • Then use the client action AccordionItemAllowTitleEvents  


In runtime, when clicking the checkbox we get the right screen action being executed:

When clicking the icon, we also get the right screen action being executed: 

Hope it helps.

Cheers,
GM

Hi Gonçalo Martins, 

Thank you for the provided screenshots! 

I needed to update my outsystem UI, since I noticed I did not have the Initialized event.

Everything is working now as expected!

Kind regards,

Dean

Hello @Dean Stavenuiter 

Can you please tell me what you want In your application

Thank you 

Hello Dean,

I had a similar issue in the past and decided not to use the accordion control but two containers instead: One for the header area and the second one for the collapsible body part. In my case the sections were built from a data list where I simply added a boolean attribute to control the collapse state of the section. The body part is then shown and hidden by assigning this boolean to the Visible property of the container. If you need an animation you can use the If UI component or come up with your own CSS to show and hide the body part container.

For sure, your problem can also be solved with some JavaScript and manipulation of the existing event handling, but I would not recommend this to avoid future issues with a new version of  the OutSystemsUI.

Hope this helps,
Sebastian

Hi @Vaishali Thakur 

If I use the checkbox it will trigger an action and will toggle the rest of the checkboxes. With the upload icon I toggle an popup. My actions are working correctly but if you click on the checkbox or the icon the title of the accordion is triggered as well and the accordion will expand or collapse. This should not be happening when I click the checkbox or the upload icon. I just want to trigger the  expand and collapse when i click on the angle up icon that is already provided in the accordion title.

I hope you understand what i mean.. 

Kind regards,

Dean 

Hii @Dean Stavenuiter,

you can use this AccordianItemAllowTitleEvents client action to prevent collapse and expanding of accordian item, In this client action you have to pass widget id which is your accordian item Id

you can call this event on ready of block/screen or on ready of your accordian block. 

then you can use checkbox inside accordian title without collapse/expand the accordian




thanks,

Sanjay Kushwah





Solution

Hello @Dean Stavenuiter 

I might be missing something but using the client action AccordionItemAllowTitleEvents in the initialize event of the AccordionItem block does the trick as expected.
I just did a quick test based on the image you shared and it worked.

  • First, use the event:
  • Then use the client action AccordionItemAllowTitleEvents  


In runtime, when clicking the checkbox we get the right screen action being executed:

When clicking the icon, we also get the right screen action being executed: 

Hope it helps.

Cheers,
GM

Hi Gonçalo Martins, 

Thank you for the provided screenshots! 

I needed to update my outsystem UI, since I noticed I did not have the Initialized event.

Everything is working now as expected!

Kind regards,

Dean

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.