Best way to have multiple sort by on RG?

Hello,

I have a database of things and I want to allow my users to “sort by” 1 - Creation date,
2 - Popularity (= data field number of likes ) with a dropdown element.

To do it I build 2 RGs one sort by creation date and another one sort by popularity and I play with show/hide to display the correct data.

It it working great but I am curious to know if there is a more performance oriented way of building it ?

Thanks in advance

Hey @Newman :wave:

I explain how to do dynamic sorting in this video. Check it out:

This should probably be a better way to sorting.

As another alternative to having two different repeating groups, you can just have a condition on the one repeating group.

There are a few ways to make improvements but here are just a couple of options.

Hope that helps. :blush:

Hello @Newman ,

When you are providing the data source to the repeating group. At that time you can sort data by creation date and popularity at the same time. For reference please go through the screenshot given below:

As you can see I have sorted the user data by user type and created date.

If any further assistance is required don’t hesitate to get in touch with me on:

LinkedIn:- Karamjit Singh - Aprintaa - Rank First To Earn Fast! | LinkedIn
Gmail:- karamwise@gmail.com

Hello,

Thank you for your reply.

I watched your tutorial and it is an interesting way of sorting an RG.

I am wondering if it is really a faster way to do it this way when you have a large dataset to filter than with a conditionnal ?

@karamwise thank you for your reply.

Having two Sort by set up like you did don’t really work on my case when users can choose what they want to see.

I think the main optimization is that it doesn’t need a bunch of different conditionals to sort on different fields. Not sure if it’s faster or not. If you had twenty conditionals to do this, then yes, this would make a difference.

If you are looking for speed improvements, there are other ways to improve that.

Examples,

  • Use TypeSense
  • Use a slimmed down version of your dataType for searches
  • Use pagination
  • Etc.

Hope that helps. :blush:

This topic was automatically closed after 70 days. New replies are no longer allowed.