Thank you for the code. I can see that you implemented your own pagination logic. Unfortunately, currently sorting and filtering isn’t supported on the data not visible in the current viewport, as pagination isn’t native Handsontable functionality.
Here you can check similar topic: Column Sorting with Pagination