简体   繁体   中英

Enable DataTables pagination dynamically

I am facing a problem where my columns don't show the proper values, apart from for the rows that are loaded by default(10). Is there any way in Datatable to disable pagination ie load all rows at once and then immediately re-enable pagination. I need it as the number of rows are too many.

This is how I am initializing the Data table:

$('#rTable').DataTable({
    paging: false
});

After it is initialized, I want to enable paging in rTable. Any way to do this?

You can try setting an All option in the length menu or set paging as false (from 1.10+).

Eg.

$('#example').dataTable({
    aLengthMenu: [
      [25, 50, 100, 200, -1],
      [25, 50, 100, 200, "All"]
    ],
    iDisplayLength: -1
});

Or

$('#example').dataTable({
    paging: false
});

Checkout this answer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM