Hello, I have been wanting to add a button to every employee details on a grid layout and I need your help to finish this. The button needs to act like a notification that sends a message, like ’ hello selected employee ’ when clicked.
If you’re talking about the Data Grid layout, that doesn’t support item-level actions. You would have to use a collection instead.
How to use the collection instead, can you please tell me?
Hello @ThinhDinh ,
I was looking to build a similar functionality. With any type of collection, how can I add a button beside each item? It only displays an item. Do you mean on click of the item define a button and add required functionality?
For any collections, you will have the ability to choose “Enable advanced actions”.
Then, from the Collection Item Actions section, you can create a new action (to have multiple actions in a flow), or choose from existing actions underneath if you only need one.
Thanks for the reply @ThinhDinh . Probably I was not clear with my question. I meant a button right beside each item in a collection. If a collection has 5 items, then in the screen I should see 5 buttons. Is that possible?
Right now, I click on an item and on the detail screen, I’ve given a button. Thought of avoiding that.
As @ThinhDinh pointed out, that would be what the Collection Item Actions are for…to place an action button on each item in the collection.
A second alternative is to use a custom collection with a button in the collection container.
Either way, you would get the result you are looking for.
Thanks a lot @Jeff_Hager and @ThinhDinh . I’d overlooked the Collection Item Actions somehow, I just tried that and it’s so cool, exactly what I wanted.
Is there a way to either change the button to a checkbox or to change the button color based on a condition. I’m trying to keep that as a mechanism to inform the user that he has chosen that particular item.
I came across this thread, but I don’t find a way to set the background color in a list. Let me dig a bit deep and see,
Check boxes do not have way too perform as action, but if you simply want a user to be able to select an item, you can use a checklist style layout of the collection, or you can use a custom collection with a switch component in the collection container. In relation to this thread in regards to the data grid, any boolean column will display as a checkbox in the grid.
There are a lot of tricks as well. Sometimes people will have a button or action on a list item that will set a boolean, and then use an IF column in the table to display a checked or unchecked emoji and then display that emoji in their list.
This thread may be useful for your use case.
Thank you @Jeff_Hager . I implemented Option 4, using a list and adding an appropriate image with a collection item action.
I change the image as well as the button label based on the value of the boolean field. Just that it would have been nice if I could change the color of the button based on the value of the boolean field. But then, I guess it’s not a big deal. Thanks again!