Is it possible to add new values to tablefooter using fnAddData()

Is it possible to add new values to tablefooter using fnAddData()

Ajith86Ajith86 Posts: 7Questions: 0Answers: 0
edited October 2012 in DataTables 1.9
I m using the following code to populate a dataTable from JSON data source.Here to refresh the table after each call I m using fnAddData() and appending the new JSON data , while doing so the table footer is not getting refreshed.. Is it possible to refresh the table footer after appending new data ?
[code]
$.ajax({
type : "POST",
url : url,
data:MODEL,
success : function(data)
{
if (typeof ddTable == 'undefined')
{
ddTable=$('#ex_table').dataTable({
"aaData" : data.response,
"aoColumns" : [
{ "sTitle": "Col1", "bSortable": true},
{ "sTitle": "Col2", "bSortable": true },
{ "sTitle": "Col3", "bSortable": true },
{ "sTitle": "Col4", "bSortable": true},
{ "sTitle": "Col5", "bSortable": true },
{ "sTitle": "Col6","bSortable": true }],
"bFilter" : false,
"bLengthChange" : false,
"bPaginate" : true,
"bInfo" : true,
"iDisplayLength" : 5,
"fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay )
{
/*displaying footer */
}
});
}
else
{
ddTable.fnClearTable( 0 );
ddTable.fnAddData(data.response);
}
}
});
[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Currently no - there is no method that DataTables presents publicly which can be used to added to the footer. You'd need to use standard DOM manipulation.

    Allan
  • Ajith86Ajith86 Posts: 7Questions: 0Answers: 0
    edited October 2012
    Hai Allan,
    I ve just started with jQuery and dataTable, So could u please suggest any ways by which it can be done with DOM manipulations
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    [code]
    $('#example tfoot').append( '...' );
    [/code]
This discussion has been closed.