way(client side or server side) to go for pagination /sortable columns?

前端 未结 4 1085
梦如初夏
梦如初夏 2021-02-02 01:34

I have 3000 records in an employee table which I have fetched from my database with a single query. I can show 20 records per page. So there will be 150 pages for with each page

4条回答
  •  暖寄归人
    2021-02-02 02:04

    USE SERVER PAGINATION!

    Sure, you could probably get away with sending down a JSON array of 3000 elements and using JavaScript to page/sort on the client. But a good web programmer should know how to page and sort records on the server. (They should really know a couple ways). So, think of it as good practice :)

    If you want a slick user interface, consider using a JavaScript grid component that uses AJAX to fetch data. Typically, these components pass back the following parameters (or some variant of them):

    • Start Record Index
    • Number of Records to Return
    • Sort Column
    • Sort Direction
    • Columns to Fetch (sometimes)

    It is up to the developer to implement a handler or interface that returns a result set based on these input parameters.

提交回复
热议问题