javascript - How to bind a Paginate button OnClick event in Datatable -


i'm using datatable populate large number of records in web-site project. , due big number of data don't want load records, need in pagination manner.

so, in datatable want each page display 10 records, , when user clicks on paginate button "2,3,...." or when click on "next" want bind click event clicked page number , based on display next batch of records.

i have query use in sql server side fetch corresponding data:

select * tablename order inserted_timestamp offset 10 rows fetch next 10 rows only; 

i want offset value changed per requested page number. idea crossed mind clicked paginate button number , multiply 10.

so question how , if if have other suggestions approach please suggest me

there 2 approach task.

  1. let ui hold key keeps track of current page being fetched. value 0. when click on next button, increment value 1 , multiply page size(10 in case). gives you offset , start position.

  2. with each response backend, send key gives next offset. send request 1st time, response returns key offset 11. next time use next set of records.

hope helps.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -