I'm following the cards as a button layout. I have a series of "buttons" that are generated dynamically.
What I'm trying to achieve is that my component tracks which buttons are currently selected.
There is a rule input which is a list of integers of the selected buttons. I would like when the button is clicked for the id of the button to be added or removed from the list and the button card will change colors from selected to not selected and back.
Currently the coloring works when setting the selected values by default but I cannot get the values to update when clicking on the "button".
a!cardLayout( contents: { a!richTextDisplayField( value: { a!richTextItem(text: local!itemNum) }, align: "CENTER" ) }, link: { a!dynamicLink( value: local!selectedPeriods, saveInto: a!save(ri!selectedPeriods, if( contains(ri!selectedPeriods, local!itemNum), remove( ri!selectedPeriods, whereContains(ri!selectedPeriods, local!itemNum) ), append(ri!selectedPeriods, local!itemNum) ) ) ) }, height: "AUTO", style: if( contains(ri!selectedPeriods, local!itemNum), "ACCENT", "STANDARD" ), shape: "ROUNDED", padding: "NONE", marginAbove: "NONE", marginBelow: "EVEN_LESS", showBorder: false, borderColor: "ACCENT", showShadow: true )
Discussion posts and replies are publicly visible
the "link:" parameter expects a link, not an array of link.
Fixing this issue seems to fix the issue I assume you're having, at least when I try it.
Always something so simple. That was it. Now I just need to update the logic for deselecting as it's just removing the first item in the list not the one I'm actually clicking on. Thanks!
Also your WhereContains is backwards - I forget this all the time, too.