fnAddData() when next.

fnAddData() when next.

argothianargothian Posts: 1Questions: 0Answers: 0
edited August 2012 in General
Hi. I'm triying to add new data to my table when I click next.

I'm triying add the data at the end of the table to it's show in the next page, but isn´t work

this my code:

[code]
var oTable;
var x = 0;
var ff= "";
var oLoadParams = {
iDataStart: 0,
iDataLength: 10,
iLock: false
};
var flag = false;
$(document).ready( function() {
oTable = $('#example').dataTable( {
"fnPreDrawCallback": function( oSettings ) {
alert( 'DataTables antes de dibujar ');

},
"fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
//alert("INFO: " + iStart +" to "+ iEnd + " " + iTotal + " " + sPre);
ff = sPre;
},
"fnFooterCallback": function( nFoot, aData, iStart, iEnd, aiDisplay ) {
alert("FOOTER: " + iStart +" to "+ iEnd + "-> " + x);
if (flag) {
if (x > iStart) {
alert("atras");
} else {
if ( (x != iStart)) {
alert("adelante");
fnClickAddRow();
}
}
x = iStart;
nFoot.getElementsByTagName('th')[4].innerHTML = "Mostrando " + iStart + " al " + iEnd + " de 1000 registros";
flag = false;
} else {
flag = true;
}

},
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
//alert("FILAS " + nRow);
},
"aLengthMenu": [10, 28, 50, "All"]
} );
} );


var giCount = 1;

function fnClickAddRow() {
$('#example').dataTable().fnAddData( [
giCount+".1",
giCount+".2",
giCount+".3",
giCount+".4",
giCount+".5"] );

oLoadParams.iDataStart = oLoadParams.iDataStart + 10;
oLoadParams.iLock = false;

giCount++;
}
[/code]

The alert's is only guide.

P.D.: Sorry my english
This discussion has been closed.