Option to sort data alphabetically #3103
-
I have a grid of logos based on an array of data that currently can be sorted by category. The partial code below has the main functionality and everything is working as it should-
If I add another list item for the alphabetical option, would it be possible to sort the logo divs based on the item.title in the array? If so, can it be incorporated into the current x-show in the template? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
x-for="item in filteredLogos.sort((a, b) => (a.name > b.name) - (a.name < b.name))"