Sorting is not saved in the database, you have to either:
Hope this helps!
you could try to make a helper-dataview (with datasource-microflow) in a dataview around your template grid.
Within the datasource, return the helper object with your sortedlist as a reference set. then within your template grid follow the reference set towards your helper object.
This is quite a lot of work.
I prefer pedro’s solution to retrieve by xpath/db and a sort in the templategrid native sorting capabilities.