If you sort a table on column A then sort on column B, the result should be a sort with B as major comparison and A as minor comparison.
Instead you get a sort with B as the major comparison, and A is ordered randomly, because the sort algorithm used is unstable.
Do not use unstable sort for user interfaces, ever. Your favorite algorithm might, /might/, be a tiny bit faster, but that feature is completely blotted out by the importance of usability.
Click to sort ascending on column 1.
-> table resorted ordered by column 1
Click to sort ascending on column 2.
-> table resorted ordered by column 2
-> column 1 is no longer sorted