How to sort a repeating group in Bubble.io by a nested field?

Anish GandhiAnish Gandhi
4 min read

Sorting a repeating group in Bubble.io is straightforward until you run into nested fields.

Let’s say you’re displaying a list of Works, and each work has a related Work_satellite data type. Now, you want to sort your repeating group of Work by the Work_satellite’s last modified date.

This is where Bubble’s built-in sorting options hit a wall, because you can't directly sort a repeating group by a nested field like Work's Work_satellite's Modified date.

But don't worry. In this article, I’ll walk you through the step-by-step process to do it.

Step 1: Load the Repeating Group’s data in the pop-up

In this example, I am loading the data of work in a pop-up

Interface showing an Elements Tree with a highlighted "Popup Hidden Variables" section containing "RG work," connected to a settings panel. The panel displays options for "Type of content" set to "Work" and "Data source" for "Search for Works."

Step 2: Install ‘Floppy: localStorage, List Shifter’ plugin

A product page for the "Floppy: localStorage, List Shifter" plugin, priced at $19 or $12/month. It has a 3.4-star rating from 14 reviews and 3.2K installs. The plugin details describe its functions for managing browser storage and manipulating lists. It includes contributor details for Keith from GRUPZ.

Step 3: Set up List Shifter as the data source of the Repeating Group of the page

Place the ‘List Shifter Pro’ element on the page and provide RG Work’s data as a List to shift shown in the image below

Screenshot of a UI builder interface showing the elements tree and settings for "ListShifterPRO Work." An arrow highlights the "List to Shift" option, which is set to "RG work's List of Works." The layout includes options for appearance and list manipulation functions like using scalars and rotating lists.

Now, place the ‘List Shifter’s shifted list’ as data source of the Repeating Group, which is on the page, and where you want to execute the sorting by field’s field, or in our case Work's Work_satellite's Modified date

Screenshot of a UI Builder interface showing an "Elements Tree" on the left with a highlighted "RepeatingGroup Work" layer. On the right, there's a panel with settings for the repeating group, including content type and data source details. A red arrow and label highlight the repeating group.

Step 4: Set up a workflow for sorting by the field’s field or the Nested field

You can either do the sorting by default when the Repeating Group is visible on page load, or you can execute the sorting when the user selects it via a dropdown or some other way.

I am setting this up as a custom event, which you can trigger on page load or when the user selects this nested field’s sorting.

I have created a custom event named ‘sort-list’ and added the action from the List Shifter plugin named ‘Sort List a List Shifter Pro

Interface of a workflow editor displaying a sorting process. The left panel shows settings for sorting a list using "ListShifterPRO," with options like type of sort, sorting by date, and descending order. The right panel outlines a custom event triggering the sort. The background is a deep purple.

As you can see in the image above**, I want to sort the RG data via modified data of nested field, that is why I have selected ‘sort as’ and ‘type of sort by list’ as date.

In the ‘sort by List’, I have selected RG Work’s List of Work’ each item’s work_satellite’s modified date. Here, RG Work is the repeating group from the popup, not from an on-page repeating group.**

Step 5: Show the Repeating Group after nested sorting is completed

There is an event from the List Shifter plugin named ‘ListShifterPRO WorkListShifterPRO Sort Complete’ that will be triggered once the custom event of sorting is executed and sorting is completed. On completion, you can now show on the page the Repeating Group with sorting by Work's Work_satellite's Modified date

A workflow diagram for "ListShifterPRO Work Sort Complete" with steps to show "RepeatingGroup Work" when the list count is greater than or equal to one, and "Group Empty State" when the count is less than one.

This is how you sort a repeating group in Bubble.io by a nested field. If you find this article helpful, you can buy me a coffee and show your support and appreciation.

0
Subscribe to my newsletter

Read articles from Anish Gandhi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Anish Gandhi
Anish Gandhi

✔️ Certified Bubble.io Developer with 2+ Years of experience in creating scalable responsive web applications. ✔️ Top Rated Plus Upwork Freelancer ✔️ Canvas framework expert