Vertical Tabs with Reactive Data Table
Last updated
Was this helpful?
Last updated
Was this helpful?
This tutorial guides you through creating an Avonni Dynamic Component that displays a list of Accounts in a vertically oriented component, and a dynamically updating Data Table showing Opportunities related to the selected Account. You'll learn how to use the , , Tabs
, and components, and how to create a reactive connection between them.
We'll build a component with the following structure:
Card: A container for visual grouping.
Columns: To create a two-column layout.
Tabs (Vertical): Displays a list of Accounts, one Account per tab.
Data Table: Displays Opportunities related to the selected Account.
Open the Avonni Components App: From the Salesforce App Launcher, find and open "Avonni Components."
Create a New Component: Click New.
Name the Component: Enter a descriptive name (e.g., "VerticalAccountOpportunities").
Open the Component Builder: Click Create.
Add the Card: Drag an Avonni Card component onto the canvas.
Set the Title (Optional): In the Properties Panel, set the Title
(e.g., "Accounts and Opportunities").
Set the Icon (Optional): Set the Icon Name
.
Expand to Content Fit: Enable the Expand to Content Fit for a better visual.
Add the Columns: Drag an Avonni Columns component inside the Card component.
Create Two Columns:
Select the Columns component, and in the Properties panel click on the plus button twice.
Select each column and set Horizontal Align to x-small
.
Add the Tabs: Drag an Avonni Tabs component into the first column of the Columns component.
Configure the Data Source:
Select the Tabs component.
Set the Data Source to Avonni Query Data Source in the Properties Panel.
Click Create a Query.
Object: Select Account
.
Filters (Optional): Add any filters to limit the displayed accounts.
Configure Tab Display:
Orientation: Set the Orientation property to Vertical
.
Items: Map the Name
field for the tab Label.
Add the Data Table: Drag an Avonni Data Table component into the second column of the Columns component.
Configure the Data Source:
Select the Data Table component.
Set the Data Source to Avonni Query Data Source.
Click Create a Query.
Object: Select Opportunity
.
Create the Reactive Filter:
Go to the Filter section of the query.
Add a new filter condition:
Field: AccountId
(on the Opportunity object).
Operator: equals
.
Value: Use direct attribute referencing to link to the selected tab in the Tabs component:
(Replace TabsComponentApiName
with the actual API Name of your Tabs component). This is crucial for the reactivity.
Optional: Add Additional Filters
Add a Filter
Field: Select StageName
Operator: Select not in
.
Value: Add Closed Won
and Closed Lost
Configure Columns:
Go to the Columns section in the Data Table Properties.
Add, remove, reorder, and customize columns as needed.
Save and Activate: In the Component Builder, Save and then Activate your Dynamic Component.
Open Lightning App Builder: Go to an Account record page in Salesforce, click the Setup gear icon, then select Edit Page.
Add the Component: In the Lightning App Builder, find your "VerticalAccountOpportunities" component (or whatever you named it) under "Custom - Managed" in the component list.
Drag and Drop: Drag the component onto the desired location on the Account record page layout.
Save and Activate (Page): Save and activate the page.
The key is : selecting a different Account tab instantly changes the Opportunities displayed in the Data Table.
This tutorial requires installing on your Salesforce org.