API Using own fields

API Using own fields

ericjlarsericjlars Posts: 1Questions: 0Answers: 0
edited January 2014 in DataTables 1.9
I am trying to figure out the api so I can use my own field for the number of records pulldown

I have been able to do this with the filter by using:

HTML



JS

oTable = $('#myTable').dataTable();
$('#myInputTextField').keyup(function(){
oTable.fnFilter( $(this).val() );
})

I can't seem to figure out how to do this for the records per page pulldown. I have:

var oTable = $('#example').dataTable();
$('#myNumber').keypress(function(){
oTable.sLengthMenu( $(this).val() );
})

and then the html markup


10
20
30


But it is not working.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I'd suggest using the fnLengthChange plug-in to change the page length programmatically: http://datatables.net/plug-ins/api#fnLengthChange

    Allan
This discussion has been closed.