Keeps selection when sorting.