Renumbering TreeTable or List Table rows and their children

Hi,
I have a TreeTable or ListTable on a Frame. The Table contains a Hierarchical Data Source.

Example DataSource : Employees (Attributes like Serial No, Name, Position, etc). It has a hierarchy property.

I am looking for a way to renumber (sequentially) a row and its children on selecting a particular row and clicking a button.

The serial number attribute value must be changed on button click. And the table rows needs to be reordered based on serial number (1-999)

Lets say 1 - 999 for parent and 1.1 - 1.999 and so on for children.

I am also looking for a way to renumber (sequentially) all rows and their children in the table by clicking a button.

Lets say 1 - 999 for parent and 1.1 - 1.999 and so on for children.

Your inputs will be helpful.

Regards,
Lokesh