Problem in CMS dataset

Question:
In the CMS, I have a leaderboard section, where I have a ranking on the first field from 1 to 10, and pushups count field which I have sorted by high to low, when the pushups get sorted, the ranking field gets sorted out to. How can I make ranking field fixed.

Product:
Wix editor

Hi, @Harsha_Reddy !!

Basically, each row in the collection represents a single unit of data. Therefore, if you sort the data by the Pushups value, the Number field will also be rearranged accordingly. In other words, for the Number field to remain fixed in ascending order (1, 2, 3, …) even when sorted by Pushups, you would need to rewrite the data itself.

One approach is to use the data hook feature to detect when the Pushups value is updated. Each time an update occurs, you can retrieve all the data, reassign the Number values accordingly, and save the updated data back to the collection. This way, the Number field remains fixed.

Alternatively, if the goal is simply to display a ranking on the site’s page using a table or repeater, you may consider removing the Number field altogether. Instead, you can dynamically assign the ranking just before inserting the data into the table or repeater. :raised_hands: