Setting iDisplayLength only for the first page

Setting iDisplayLength only for the first page

emikemik Posts: 1Questions: 0Answers: 0
edited April 2013 in DataTables 1.9
I currently have the following code that prepends a row to the start of the table, but only on the first page (I realise this is probably bad practice but I struggled to get fnAddTr etc. to work with server-side code). The problem is that iDisplayLength stays at 24 on page 2, and only on page 3 does it go up to 25. If you navigate back from page 3 to page 2, however, it's up to 25. How can I stop page 2 from defaulting to length 24?

[code]
"fnDrawCallback": function(oSettings) {
if(oSettings._iDisplayStart == 0){
$('#results tbody').prepend('');
$('#results tr.odd:last-child').remove();
oSettings._iDisplayLength = 24;
}else{
oSettings._iDisplayLength = 25;
}
}
[/code]
This discussion has been closed.