I had my own heap sort algorithm that worked well and allowed for nested row sorts, and controlling sort based on integers, strings, and dates. It worked very well and was much faster than a bubble sort.
For fun, I rewrote this using TStringLists, exporting the column data (that's sorted) to the stringlist, using its sort routine with the anonymous function parameter to select the type of data, then moving the original rows around based on the results of the TStringList sort. To my surprise, this was faster than the heap sort. Not by much, but noticeable with thousands of rows. I now use it as my native grid sort.