-1

Folks, My application is build based on SQL server, PHP, JavaScript. The PHP code is where I configure all controller, it's a middle layer between my View ( JavaScript) and my server ( SQL). My search result page looks like this:

Like this

For example, I display 10 search results in one page over 10000 results. The problem came when I have too many results. The page rendering process takes up to 25 seconds. Now I want to do something like : each time I click to a second page that showing result from (example 11 - 21), then after onClick, the second-page result need to call server again and render result from 11-20. I'm using datatable but not sure it's right track. Thanks.

Andrew
  • 23,242
  • 6
  • 75
  • 89
Kyle
  • 11
  • 6

2 Answers2

1

You should just select the results per page/row number and just calculate which results you need, like this:

SELECT  *
FROM    ( SELECT    ROW_NUMBER() OVER ( ORDER BY OrderDate ) AS RowNum, *
          FROM      Orders
          WHERE     OrderDate >= '1980-01-01'
        ) AS RowConstrainedResult
WHERE   RowNum >= 1
    AND RowNum < 20
ORDER BY RowNum

This SQL is a copy from mdb's answer for pagination, the thing you need: What is the best way to paginate results in SQL Server

emanuilov
  • 132
  • 10
0

You can use the pagination property of data table. whenever you will click on page noº it will send a request to the server and return the number of rows.

the following link may help you Ajax calls for pagination

svelandiag
  • 4,201
  • 1
  • 33
  • 66