Server side pagination using DataTables plugin

后端 未结 2 1590
Happy的楠姐
Happy的楠姐 2021-02-19 13:28

The server is returning 15 records per page and the total records are over 2000. I\'d like to display first 15 records and then on every click of the \'Next\' button , display t

相关标签:
2条回答
  • 2021-02-19 13:56

    enter image description here

    Pagination works total displayed record you need to perform following minimum changes.

    "iTotalDisplayRecord" will be total filtered records

    0 讨论(0)
  • 2021-02-19 13:57

    This looks up your alley -> http://datatables.net/examples/data_sources/js_array.html It's purely client-side

    Though, as far as I know, the only way to achieve actual pagination (making it faster because you're only fetching 15 records from the database at a time) is by ajax-ing with your server side (i.e. http://datatables.net/examples/data_sources/server_side.html)

    It doesn't look to me like you're doing that. Unless... self.accountCollection.getData() is an ajax callback, but in any case when you instantiate the DataTable you should use "ajax: tableData" not "aaData: tableData".

    You may be confusing the JSON that datatables returns, with the datatables API that you use to interact/initialize with the datatable.

    Sorry, that was a bit much lol does any of that make sense?

    0 讨论(0)
提交回复
热议问题