Is it possible to add new values to tablefooter using fnAddData()
Is it possible to add new values to tablefooter using fnAddData()
Ajith86
Posts: 7Questions: 0Answers: 0
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]
[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]
This discussion has been closed.
Replies
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
$('#example tfoot').append( '...' );
[/code]