Hello,
I have a repeater with images linked to a dataset. I am able to do a filter option to display only certain items. But I would like to separately sort them and display them according to the sort criteria for certain connected data. I cannot seem to find any option to do this.
Is this solvable only using code or is there some option somewhere to enable this?
Any help would be appreciated, thanks.
HI! Are you trying to sort this before it is shown in the repeater, or are you trying to add a sort option to the live page that then sorts the repeater based on the chosen criteria?
If youâre trying to sort the data ahead of time to only show certain data in a repeater, you can do so by adding a sort (or even a filter) within the connected dataset settings. To do so, connect a dataset to your repeater, then click âsettingsâ then âadd sortâ:
Otherwise you can achieve the same functionality using a wixData sort with Velo:
Hereâs a more detailed explanation from wix support docs:
Thanks I am trying to sort after displaying the data to give the user the option to view the data in the manner they prefer. I have implemented a filter using the input dropdown element but there is nothing pre-formatted like that for a sort.
I shall try the options you have suggested. Thank you!
Gotcha! Iâm not currently using a custom sort feature on my sites, BUT I did come across this awesome example from @anon72313111 on Wix Velo examples: https://www.wix.com/velo/example/multiple-filter-methods
His âqueryAndsort.jswâ code might be helpful as inspiration for what you need
Looks like just what I am looking for. I donât have much experience in coding so it will take a while for me to figure out and adapt but I look forward to doing so Thank you, much appreciated!
No problem! And if youâre just getting started with coding on Wix, thereâs a great free course on Codecademy called Create a Professional Website with Velo by Wix | Codecademy. I actually used that to start my coding experience. That might be enough to get you going with the sorting functionality you need, but if youâd like to dive-in further, youâll probably want to take a full JavaScript course like Codecademyâs free course: Learn JavaScript | Codecademy (I also took that one and that provided the basis I needed to create some cool stuff on Wix/EditorX).
Best of luck!