Hi Neha bit of a long winded process but…
You should be able to get somewhere with datagrid server side rendering
https://docs.mendix.com/refguide/server-side-paging/
This will let you use the Mendix paging object that has page number attribute that you can then feed into your method of getting the data. Then have a text input for page number and after change event that commits and refreshes the object to refetch the data with the new page number.
You’ll lose a lot of built in functionality this way though and wouldn’t recommend it for development unless necassary.