LogoLogo
HomepageYouTube ChannelInstall from the AppExchange
  • Home
  • Dynamic Components
  • Flow Components
  • Experience Components
  • Projects
  • 👋Welcome
  • Getting Started
    • Product Tour
    • Quickstart Tutorial
    • Understanding The Essentials
      • Component Builder
      • Component Visibility
      • Target Page Object
      • Using Variables and Component Data
      • Publishing your Dynamic Components
      • Dynamic vs. Flow Components
    • Avonni Components App
      • Accessing the App
      • Folders
      • Templates
      • Version management
    • AppExchange Listing Page
    • Installation & Licenses Management
  • Tutorials
    • Projects
    • Components
      • Calendar
        • How to Create Events Quickly by Dragging
        • How to Add an Edit Action to Calendar Events
        • How to Add a New Event Button to the Calendar Header
        • How to Customize the Right-Click Menu
        • How to Reschedule Events with Drag and Drop
      • Columns
        • Creating a Responsive 3-Column Layout
      • Data Table
        • How to customize Data Table style
        • How to make a field editable
        • How to add clickable buttons
        • How to color-code badges
        • How to export data
        • How to configure search
        • How to set columns visibility
      • Kanban
        • Saving Changes on Drag-and-Drop
      • List
      • Metric
      • Record Detail
        • Saving Changes
    • Interactions
      • How to create an interaction to navigate to an object page
      • How to create an interaction to navigate to a record page
      • How to Pass Multiple Selected Records from a Dynamic Component to a Screen Flow
    • Reactive Components
      • Reactive Map and Data Table
      • Master-Detail Relationship with Data Tables
      • Vertical Tabs with Reactive Data Table
    • Style
      • How do you add space or a break between sections or fields?
    • Tips and Tricks
      • Using the Dynamic Component component
  • Component Builder
    • Overview
    • Configuring Components
      • Properties
      • Fields
      • Style
    • Data & Interactions
      • Data Sources
        • Manual
        • Picklist
      • Resources
        • Constant
        • Formula
        • Nested Queries
        • Query
        • Variable
      • Interactions
        • CRUD from Record Variable
        • Download
        • Execute Flow
        • Navigate
        • On Load
        • Open Alert Modal
        • Open Confirm
        • Open Dynamic Component Dialog
        • Open Dynamic Component Panel
        • Open Flow Panel
        • Open Flow Dialog
        • Show Toast
    • Advanced Topics
      • Undo / Redo
      • Copy and Paste
      • Keyboard Shortcut
  • Components
    • Explore All Components
    • Accordion
    • Alert
    • Audio Player
    • Avatar
    • Avatar Group
    • Badge
    • Barcode
    • Blockquote
    • Button
    • Button Group
    • Button Icon
    • Button Menu
    • Button Stateful
    • Calendar
    • Camera 🆕
    • Card
    • Carousel
    • Chart
    • Checkbox
    • Checkbox Button
    • Chip Container
    • Color Picker
    • Columns
    • Combobox
    • Container
    • Counter
    • Data LWC Container
    • Data Table
    • Date Picker
    • Date
    • Date Range
    • Dual Listbox
    • Dynamic Component
    • Formatted Address
    • Formatted Name
    • Formatted Value
    • Header
    • Icon
    • Icon Picker
    • Illustration
    • Image
    • Input Color
    • Input Date
    • Input Pen (Signature)
    • Input Text
    • Kanban
    • List
    • LWC Container
    • Map
    • Media Object
    • Metric
    • PDF Viewer
    • Pivot Table
    • Progress Bar
    • Progress Circle
    • Progress Indicator
    • Rating
    • Record Detail
    • Relationship Graph
    • Scope Notification
    • Section
    • Separator
    • Slider
    • Status
    • Tabbed Container
    • Tabs
    • Text
    • Text Area
    • Timeline
    • Toggle
    • Tree
    • Vertical Visual Picker
    • Video Player
    • Visual Picker
    • Visual Picker Link
  • Help
    • Contact Support
    • Security
    • Performance Guide
    • Deployment Process
    • Release Notes
    • Report Bugs
Powered by GitBook
LogoLogo

Company

  • About Us
  • Pricing

Policies

  • Privacy Policy
  • Terms of Service
On this page
  • Overview
  • What We'll Build
  • How it Works
  • Guided Steps
  • Step 1: Prepare the Layout
  • Step 2: Add and Configure the Data Table (Master)
  • Step 3: Add and Configure the Map (Detail)
  • Step 4: Test the Reactivity

Was this helpful?

  1. Tutorials
  2. Reactive Components

Reactive Map and Data Table

Last updated 2 months ago

Was this helpful?

Overview

This example demonstrates an everyday use case for reactive components: connecting an Avonni and an Avonni to create an interactive visualization. You'll see how selecting a record in the Data Table can automatically update the Map to display the corresponding location.

What We'll Build

We'll create a simple component with two main elements:

  • Data Table: Displays a list of Accounts.

  • Map: Displays the location of the currently selected Account from the Data Table.

How it Works

The key to this interaction is a reactive filter on the Map component's data source:

  1. Data Table: The Data Table is configured with a data source (e.g., a Query) that retrieves Account records, including address/location information (e.g., Billing Street, Billing City, Billing State/Province, Billing Zip/Postal Code, Billing Country).

  2. User Selection: The user selects an Account in the Data Table.

  3. firstSelectedRow Update: The Data Table's firstSelectedRow property automatically reflects the newly selected Account.

  4. Reactive Filter: The Map component's data source is configured with a filter that references the firstSelectedRow.Id property of the Data Table. This is the reactive link.

  5. Automatic Map Update: Because of the reactive filter, when firstSelectedRow changes, the Map's data source re-queries Salesforce, retrieves the location data for the newly selected Account, and updates the Map display automatically.

This creates a seamless user experience where selecting an Account instantly updates the Map to show its location.


Guided Steps

To create a reactive connection between a Data Table and a Map, follow these steps:

Step 1: Prepare the Layout

  1. Two-Column Layout: Add a two-column layout component to your Dynamic Component. This will allow you to place the Data Table and Map side-by-side.

Step 2: Add and Configure the Data Table (Master)

  1. Add Data Table: Drag an Avonni Data Table component into the left column of your layout.

  2. Configure Data Source:

    • Click on the Data Table component to open its properties panel.

    • Select Avonni Query Data Source as the data source type.

    • Click Create a Query, or select an existing query.

    • Object: Select Account.

    • Filters (Optional): Add any static filters you need (e.g., to show only Accounts of a certain type). Do not add the reactive filter here.

    • Add columns to your Data Table via the "Columns" section in the Properties Panel. For each column, click "Add Column", select a "Source Field," and configure any other desired settings (Label, Editable, etc.).

  3. Limit Row Selection:

    • In the Data Table properties, find the setting for Max Row Selection (or similar).

    • Set it to 1. This ensures that only one Account can be selected at a time, which is necessary for our reactive Map.

Step 3: Add and Configure the Map (Detail)

  1. Add Map: Drag an Avonni Map component into the right column of your layout.

  2. Configure Data Source:

    • Click the map to open the properties.

    • Select Avonni Query Data Source.

    • Object: Select Account.

  3. Create the Reactive Filter:

    • Open the filter editor for the Map's query data source.

    • Add a Filter Condition:

      • Field: Select the Id field (or the field that uniquely identifies Accounts).

      • Operator: Choose equals.

      • Value: Use direct attribute referencing to link to the selected row in the Data Table:

        !AccountsTable.firstSelectedRow.Id

        (Replace AccountsTable with the actual name of your Data Table component).

  4. Select Map Location Fields

    • In the Map Properties, select the field that matches the location fields.

    • Configure Map Location Fields: In the Map component's properties, find the section for configuring location data (it might be labeled "Location," "Map Settings," or similar). You need to tell the Map component which fields in your data source contain the address or coordinates. For example, you might map:

      • BillingStreet to the "Street" field in the Map settings.

      • BillingCity to the "City" field.

      • BillingState to the "State/Province" field.

      • BillingPostalCode to the "Zip/Postal Code" field.

      • BillingCountry to the "Country" field.

      Select the correct fields from your data source corresponding to each part of the address. If you are using latitude/longitude, map those fields accordingly.

Step 4: Test the Reactivity

  1. Preview: Preview your Dynamic Component.

  2. Select an Account: Click on a row in the Data Table.

  3. Observe the Map: The Map should automatically update to display the location of the selected Account

Data Table
Map