How to Reorder Items and Update Records
Last updated
Last updated
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.
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.
By default, the list doesn't allow reordering. To let users rearrange items:
Find the "Sort" section in the list settings.
Turn on the "Sortable" option.
Now, users can drag and drop items to change their order.
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.
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.