If you want to add records sorting with header click on your existing pagination code then you need to write some extra code for it.
This improves the user experience while traversing on the long list of paginated records.
The user can easily sort a column and view the list e.g. sorting employee list by its salary, age, etc.