Method to get and set Table Row display ID

Greetings fellow Gristers!

Would anyone know of a method to get and set the row ID (1…6 in the image)?

image

In the image, the table has been filtered and sorted to give 6 records (1…6). I am looking to manually change the order in which these records are displayed.

The $id maps to the records. But if filtering/ordering is used, the table has a unique set of Table Row display IDs (1…6).

The solution i have presently, is to have a column with integers ($Order), where the table is sorted using the $Order entered here. It works fine, until I need to insert a record in the middle of records (e.g. between 2 and 3). At this point I will need to change the value in the Order field for all records starting from 3 to 6.