Build a reactive Data Table Using Dependent Picklists
Last updated
Last updated
This tutorial will show you how to use Avonni Comboboxes (drop-down lists) configured to be dependent picklists to control the data shown in the Avonni Data Table. When you select an option from one combobox, the table will automatically update to display only the relevant information.
To make the Avonni Data Table change its data based on what's selected in the comboboxes, we'll create a special formula. This formula will act as a filter for the Data Table's query, so the table will dynamically show the correct information based on the choices made in the comboboxes.
This formula controls the data shown in the Data Table based on the selections made in two combo boxes: "combobox_maker" (for car makers) and "combobox_model" (for car models).
Here's how it works:
IF(ISBLANK({!combobox_model.value})
: This part checks if the user has selected anything in the "combobox_model" combobox.
If nothing is selected, the formula filters the Data Table to show only cars from the maker selected in the "combobox_maker" combobox. For example, if the user selects "Honda" in the maker combobox, the table will show all Honda cars, regardless of the model.
If a model is selected, the formula refines the filter to show only cars that match the selected maker and model. For example, if the user selects "Honda" as the maker and "Civic" as the model, the table will show only Honda Civic cars.
This formula allows for a dynamic and interactive filtering experience—the data Table updates in real time based on the user's choices in the combo boxes.
Connect the formula variable we just created to the "Query Filter" option in the Data Table settings. This will make the Data Table reactive, meaning it will automatically update its data based on the selections made in the combo boxes.