If you are on local mode there is a such option – deselectAfterSort, but if you using server side paging and sorting you can do this using the onSelectRow, gridComplete and setSelection events. Use first to store the selection and the other to make the selection when the user sort or etc.
Note: use the second parameter in onSelectRow to remove the selection if the user deselects it.