display all table records on multiple tables

display all table records on multiple tables

pohpoh Posts: 2Questions: 0Answers: 0
edited August 2013 in DataTables 1.9
Hi, on my site i have tabs where I'm loading different tables, but with the same configuration. According to documentation, I'va tried to simplify the js so with this
[code]$(document).ready(function() {
$('.user-account .dataTable').dataTable();
} );[/code]

and this is my code for displaying all records on one table
[code]$('.user-account #my_table a.pagination-all').click( function () {
var oSettings = my_chips_table.fnSettings();
if($(this).hasClass('clicked')){
oSettings._iDisplayLength = 10;
}else{
oSettings._iDisplayLength = -1;
}
my_chips_table.fnDraw();
});[/code]
and this works, but when I try to replace first line with this
[code]$('.user-account .dataTable a.pagination-all').click( function () {[/code]
It doesn't work. So could You help me to make this work with multiple tables?

Replies

  • pohpoh Posts: 2Questions: 0Answers: 0
    no one can help?
  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    You should never set the values of oSettings directly - us one of the plug-in API methods - specifically this one for this case: http://datatables.net/plug-ins/api#fnLengthChange .

    Allan
  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    Oh also, you'll need to use the iApiIndex option to have it operate on more than one table.

    DataTables 1.10's API will allow updating the settings of all tables in an instance directly (its in git if you are feeling brave) and has this ability built in.

    Allan
This discussion has been closed.