Hey @Support-Luis!
Trying to get a default sort working with combine. I used a snippet from another thread, but it’s doing something funky. Here is my setup and overview of the issue:
Sandbox - Webflow - Ambient AI - New UI
Staging URL - Resources
Hey @Support-Luis!
Trying to get a default sort working with combine. I used a snippet from another thread, but it’s doing something funky. Here is my setup and overview of the issue:
Sandbox - Webflow - Ambient AI - New UI
Staging URL - Resources
Hey @hello6!
Your HTML structure looks correct with all the right attributes in place for fs-list-combine with filtering and loading functionality ![]()
This “funky behavior” with default sorting in combine setups is typically a timing issue where sorting happens before combine and load features fully initialize.
Here’s a callback that will handle default sorting with your combine setup:
<script>
window.FinsweetAttributes = window.FinsweetAttributes || [];
window.FinsweetAttributes.push([
'list',
(listInstances) => {
const [listInstance] = listInstances;
listInstance.addHook('afterRender', (items) => {
listInstance.sorting.value.fieldKey = 'date';
listInstance.sorting.value.direction = 'desc';
});
},
]);
</script>
Make sure your date field has fs-list-fieldtype="date" attribute since you’re sorting by date, as seen on the docs. This callback waits for the combine and load processes to complete before applying the sort.
Another option is to use the renderitems event if you need more precise timing control
But the afterRender hook is usually more reliable for combine + load scenarios.
Add the script to your page’s custom code section (Before tag).
If you need more help with this, @Support-Luis, @Support-Pedro or @jesse.muiruri can assist further.
Worked a treat, thanks @Support-Finn