/retool-tutorials

How to create master-detail views in Retool?

Learn how to create master-detail views in Retool with step-by-step instructions for building a dynamic interface using tables, detail panes, and queries.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web or mobile app? RapidDev builds Retool apps with your growth in mind.

Book a free No-Code consultation

How to create master-detail views in Retool?

 

Creating Master-Detail Views in Retool

 

A master-detail interface allows users to select an item from a list (the "master" view) and see the details of that item in a separate panel (the "detail" view). In Retool, building this type of functionality involves creating a combination of table components, detail panes, and queries to bind them together. Here's a step-by-step guide to achieving this.

 

Prerequisites

 

  • Ensure you have access to a Retool account and an existing workspace to build upon.
  • Basic knowledge of how to create queries and work with Retool's component library.
  • Access to the data source you'll be using, whether it's an SQL database, a REST API, or another type of data source supported by Retool.

 

Setting Up the Data Source

 

  • Log in to your Retool dashboard and navigate to the desired application or create a new one.
  • Add a new data source by clicking on

    Resource

    in the main menu, then

    Create New

    to link to the database or API you plan to use for your master-detail views.

 

Creating the Master View with a Table

 

  • Drag a

    Table

    component from the component panel onto your Retool interface. This will serve as your master view, displaying the list of items.
  • Bind the table to a data query by creating an SQL query or API call that fetches the master list data. For example, an SQL query could be: SELECT * FROM items;.
  • Ensure the table's data field is set to the name of your query (e.g., {{ query.data }}).
  • Customize the table columns to reflect essential fields such as item name, ID, or any relevant preview information.

 

Creating the Detail View Pane

 

  • Add a

    Container

    component next to the table to keep your detail view organized.
  • Within the container, place various components (e.g., text fields, numbers) to display detailed information about the selected item. For instance, you could drag in

    Text

    and

    Image

    components if your details include textual descriptions and images.

 

Linking the Master and Detail Views

 

  • Create a new query or API call to fetch the details of the selected item. This query should filter the result set based on the selected item from the table. For example: SELECT * FROM items WHERE id = {{ table.selectedRow.data.id }}.
  • In the detail components, bind each element to the appropriate fields in the detail query's result. For example, for a text component displaying an item description, you would use a binding like {{ detailQuery.data.description }}.
  • Set the detail query to run automatically when the selection changes in the table. This can be done in the query's settings under "Triggers" to run on table selection change.

 

Adding Interactivity and Enhancements

 

  • Implement a "loading state" in the detail view components to handle cases where the data is fetching, which improves user experience. Use conditional display logic in Retool's properties panel.
  • Allow for edits in the detail view if needed. If making fields editable, ensure there's a corresponding update query to push modifications back to your data source.
  • Consider using other components such as buttons for additional actions like "Delete" or "Refresh" on the detailed item, and wire these to respective queries.

 

Testing and Validation

 

  • After setting up the master-detail views, test the application by selecting different rows in the table and verifying that the correct details are displayed.
  • Assess the application's response time and ensure that all queries execute as expected without significant delay.
  • Make sure any data updates or deletions behave correctly with live data integration.

 

Deploying and Sharing Your Dashboard

 

  • Ensure all components and queries are set up correctly and in line with your deployment requirements.
  • Publish your Retool app by selecting the appropriate deployment option and ensure it is accessible to your designated audience by adjusting user permissions as necessary.
  • Share your creation with team members or stakeholders, providing instructions on how to interact with the master-detail views.

 

By following these steps, you can effectively build a master-detail interface in Retool, enabling users to seamlessly navigate between a summary view and a detailed view of the selected data. Test thoroughly to ensure responsiveness and accuracy in data representation.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022