How to remove pagination and show all items at runtime

How to remove pagination and show all items at runtime

pfgpfg Posts: 5Questions: 0Answers: 0
edited September 2011 in General
I initialize my dataTable with "iDisplayLength": 5.
I wan't to show all items when a user press a button, but i can't use the built in "aLengthMenu".
I tryed to use this code to change the pagination display lenght but doesn't work:

[code]
var oTable = $('#tableDetails').dataTable();
var oSettings = oTable.fnSettings();
oSettings.iDisplayLength = 100;
oTable.fnDraw(true);
[/code]

The pagination size can't be updated at runtime? Or I need to change in other way?

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    oSettings._iDisplayLength = 100;

    I'm assuming the underscore indicates this is meant to be a private member and not suitable for development as it may change. but this does work.

    Maybe someone can chime in on a better or more favored solution.

    http://i.imgur.com/oZiWJ.png (pic of debugger viewing the oSettings obj)
  • pfgpfg Posts: 5Questions: 0Answers: 0
    Thanks, it works!
    I was assuming that the oSettings had the same properties of the initial configuration, didn't notice the underscore.
    It wasn't throwing javacript error, so I assumed that the name of the property was ok.
This discussion has been closed.