How to Reorder Items and Update Records

Overview

Imagine a to-do list app where users can easily rearrange tasks to prioritize their day. The Avonni List component makes this possible. Users can drag and drop tasks - or any other items - to change their order, and the app automatically updates the task order in the background. This provides a more intuitive and flexible way for users to manage their to-do lists.

Step-by-Step Guide

Step 1: Configure the Avonni List

  • Set up your Avonni List to display the data you need using the Query Data Source.

  • In the List settings, choose the field that stores the order information (e.g., "Order__c") as the "Order By" field. This is crucial for the reorder functionality to work.

Step 2: Activate the reorder capability on the list

By default, the list doesn't allow reordering. To let users rearrange items:

  1. Find the "Sort" section in the list settings.

  2. Turn on the "Sortable" option.

  3. Now, users can drag and drop items to change their order.

Step 3: Add the Reorder Interaction

  • Under the "Interactions" section, find the "Reorder" event.

  • Add an "Update Records Order" interaction to this event. This will automatically update the order field in your records when you drag and drop items to rearrange them in the list.

Step 4: Refresh the List

  • Add a "Refresh query" interaction to ensure the list visually reflects the new order after reordering.

  • Set this interaction to trigger "After" the "Update Records Order" interaction.

And that's it! You've now enabled the powerful drag-and-drop reordering feature in your Avonni List, which automatically updates records.

Key Points:

  • Make sure your data has a field representing the order (e.g., "Order__c").

  • Set this field as the "Order By" field in the List settings.

  • Use the "Update Records Order" interaction on the "Reorder" event.

  • After reordering, add a "Refresh query" interaction to update the list visually.

Last updated