Don't clear the TR elements of the table when sorting them. Appending them in order results in the same effect.