Change oTableTools parameters on a fnReloadAjax 1.9.4/1.10

Change oTableTools parameters on a fnReloadAjax 1.9.4/1.10

Flo_comFlo_com Posts: 4Questions: 0Answers: 0
edited January 2014 in General
Hi,

I have a drop down menu that triggers a fnReloadAjax on select. It works great. This is my code

[code] $('select').on("change", function(){
var selected = $(this).val();
makeAjaxRequest(selected);
})

opts = "no"

d_table = $('#table_id').dataTable( {
"bProcessing": true,
"sAjaxSource": "/count",
"sServerMethod": "POST",
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "opts", "value": opts } );
},
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bAutoWidth": false,
"oTableTools": {
"sSwfPath": "/assets/datatable/media/swf/copy_csv_xls_pdf.swf",
"aButtons": [
"copy", {
"sExtends": "csv",
"sButtonText": "CSV",
"sFileName": "*.csv",
"sTitle": opts,
"mColumns": "visible"
},
{
"sExtends": "xls",
"sButtonText": "XLS",
"sFileName": "*.xls",
"sTitle": opts,
"mColumns": "visible"
}
]
}
});

function makeAjaxRequest(selected){
opts=selected;
d_table.fnReloadAjax();
} [/code]

I would like "sTitle" in the TableTools settings to update on the fnReloadAjax call.
Do I need to customize fnReloadAjax? How?
Or maybe there is another way?

Also, I need the change/method to be compatible with datatable 1.10... And I am not that good with JS/Jquery!

Thanks,
Flo

Replies

  • allanallan Posts: 63,695Questions: 1Answers: 10,500 Site admin
    There is no public API in TableTools at the moment to change a button's title after initialisation. You would need to modify the TableTools source code to add that ability.

    Allan
  • Flo_comFlo_com Posts: 4Questions: 0Answers: 0
    Understood. Thanks Allan.
This discussion has been closed.