If you need pagination, and don't want to download the entire data to the client, then you must perform the sorting on the server (otherwise the client can only sort the rows it currently has, which will lead to wrong results, if you re-sort by a different column)
Sorting on the server is faster (as in: you can sort more rows/second), but if you have to serve 10000 clients at once, this may easily invert.
When sorting on the client, you can re-sort without downloading the data again.