Work in Progress: How to Create Repeatable Button Components, Fetching from a Database
Step 1: Create and Prepare your Button
Create a button where you want the list of buttons to appear.
Select the component and scroll to the bottom of the Options tab, open the Advanced dropdown.
Select the REPEATER KEY. This will be the key of the Computed field that is fetching the data and returning the array of objects. Here are some docs for reference:
Step 2: Transform the Data
Map it into an object with a 'key' key, and a 'text' key. Something like this:
function result( {
full_list_key
} ) {
return full_list_key.map(data =>{
key: data.id,
text: data.text
})
}Try giving it an HTML structure. For example:
Step 3: Style it
Add some classes so you can style it with custom selectors
Here's how to style components with custom selectors:
What if there's more data that I want to show when a user selects one of the options?
Another computed field can easily solve that. The code would look something like this:
This would return the full selected object!
PreviousWork in Progress: How to add Chart.js to your flow
NextWork in Progress: How to Create a Global Column
Last updated