How to show different num of entries via some other element

How to show different num of entries via some other element

MiroslavMiroslav Posts: 1Questions: 0Answers: 0
edited November 2011 in General
Hello.

Default element to show num of entries is select[name=datatable_length].
How can I change this num with, for example on click:
[code]10
20
30
40[/code]
...

I mean, I want to do it with "click" event.

Thanks.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    Not documented, but you can get the settings object, change _iDisplayLength, then redraw

    [code]
    function change_DisplayLength(displaylen) {
    oTable = $('#yourTable').dataTable( { bRetrieve: true } );
    oSettings = oTable.fnSettings();

    oSettings._iDisplayLength =displayleni;
    oTable.fnDraw(); // this will dump the user back on page 1, so you might want to calculate the correct page and jump to that page for them after a change
    }
    [/code]
This discussion has been closed.