0

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 i.e. 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?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
user3766332
  • 319
  • 1
  • 5
  • 17
  • Some code sample, or a JSFiddle would be nice to help us. – DFayet Jun 22 '15 at 10:46
  • Made the edit in the question – user3766332 Jun 22 '15 at 10:48
  • 1
    From a datatables developer: `The short answer is that you cannot alter initialisation options after the table has been initialised, unless there is an API available for it. You need to reinitialise the table.` [Source](https://www.datatables.net/forums/discussion/16373/enable-disable-features-after-initializing-the-table) – Rory McCrossan Jun 22 '15 at 10:51
  • There must be something wrong with your data or code logic. In client-side processing mode DataTables already does what you need, i.e. load all rows at once but display `10` records by default by adding pagination control. You don't need to enable/disable pagination for this to work. – Gyrocode.com Jun 22 '15 at 16:16

1 Answers1

-2

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

Community
  • 1
  • 1
Karthik
  • 1,363
  • 2
  • 12
  • 13