Reputation: 1216
I have an api/url that has query parameters for page_size and page_num. I am using ajax call to fetch data with hard-coded values for both and populating the table(working fine). But I want to populate datatable as user selects the page number. I can hard-code (ideally not) the page size, but i need dynamic ajax request to be made as user selects page number. How to implement this using datatables and jquery?
Upvotes: 0
Views: 134
Reputation: 1
DECLARE @FirstRec int,@vQuery nvarchar(max) ,
@LastRec int
SELECT @FirstRec = (@pPageNo - 1) * @pPageSize -- Calculating the first rec no and last rec no
SELECT @LastRec = (@pPageNo * @pPageSize + 1)
Select ROW_NUMBER() Over (Order By Cast(AppointmentDate as Datetime) Desc) As RowNO, a.*
Into #tbl
From
(
select *
from tbl
) a
Select * From #tbl Where RowNo > @FirstRec AND RowNo < @LastRec
Select COUNT(*) As TotalRecords From #tbl
Upvotes: 0