I only want to replace the export flash buttons with html5 button, rather touching any other code
I only want to replace the export flash buttons with html5 button, rather touching any other code

$('.inner-tables').each(function(){
var $this = $(this);
var locationName = $this.prop('id');
var locationID = $this.data('id');
var tableID = $this.find('table').prop('id');
$('#mtTable').dataTable({
"sDom": "<'dt-toolbar'<'col-xs-12 col-sm-6'f><'col-sm-6 col-xs-6 hidden-xs'T>r>"+
"t"+
"<'dt-row dt-bottom-row'<'col-sm-6 col-xs-12 hidden-xs'i><'col-sm-6 col-xs-12 text-right'p>>",
"oTableTools": {
"aButtons": [
"copy",
"csv",
"xls",
{
"sExtends": "print",
"sMessage": "Generated by Ruth<i>(press Esc to close)</i>"
}
],
"sSwfPath": "/cadfolio/js/dashboard/plugin/datatables/media/swf/copy_csv_xls_pdf.swf"
},
"sServerMethod": 'POST',
"sAjaxSource": "/dashboard/3d-printing/,
"aoColumnDefs": [
{"bSortable": false, "aTargets": [6,7,8,9,10,11]},
],
"bProcessing": true,
"bServerSide": false, // Currently set to false so export works with all records
"iDisplayLength": 25,
"aaSorting": [[ 5, "asc" ]],
"sPaginationType": "bootstrap",
"bAutoWidth": false,
"aoColumns": [
{ sWidth: '6%' },
{ sWidth: '6%' },
{ sWidth: '20%' },
{ sWidth: '15%' },
{ sWidth: '12%' },
{ sWidth: '8%' },
{ sWidth: '13%' },
{ sWidth: '8%' },
{ sWidth: '8%' },
{ sWidth: '8%' },
{ sWidth: '8%' },
{ sWidth: '8%' },
{ sWidth: '8%' }
],
"fnInitComplete": function(settings){
$('#'+locationName+'-count').text(settings.fnRecordsTotal());
},
"fnServerParams": function ( formData ) {
formData.push( { "name": "_token", "value": '{!! csrf_token() !!}' } );
}
});
});
This discussion has been closed.
Answers
Please help me on this, because i want to remove flash buttons on entire application and being used in many places.
Looks like you are using the TableTools extension and that you want to convert to using the Buttons extension. To change you will need to use the Download Builder to download the Buttons extension code, update your web pages to include this code and update your Datatables config to use buttons instead of tableTools.
Kevin
Yes. I have done the same thing, but there i am facing many errors. Even single ajax call is not working. Here is the code
$('#new-orders').dataTable({
dom: 'Bfrtip',
buttons: [
'copy',
'excel',
'csv',
'pdf',
{
extend: 'print',
messageTop: 'Generated by Ruth<i>(press Esc to close)</i>'
}
],
"ajax": {
"url": "/dashboard/3d-printing/",
"type": "POST"
},
"columnDefs": [
{"sortable": false, "targets": [6,7,8,9,10,11]}
],
"processing": true,
"serverSide": false, // Currently set to false so export works with all records
"displayLength": 25,
"sorting": [[ 5, "asc" ]],
"paginationType": "bootstrap",
"autoWidth": false,
"columns": [
{ sWidth: '6%' },
{ sWidth: '6%' },
{ sWidth: '15%' },
{ sWidth: '15%' },
{ sWidth: '13%' },
{ sWidth: '8%' },
{ sWidth: '15%' },
{ sWidth: '10%' },
{ sWidth: '8%' },
{ sWidth: '8%' },
{ sWidth: '8%' },
{ sWidth: '8%' },
{ sWidth: '8%' }
],
"fnInitComplete": function(settings){
$('#new-count').text(settings.fnRecordsTotal());
},
"fnServerParams": function ( formData ) {
formData.push( { "name": "_token", "value": '{!! csrf_token() !!}' } );
},
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if ( aData[4].indexOf('oversized-print') >= 0 ) {
console.log(aData);
$(nRow).addClass( 'hell' );
}
},
});
What are the errors?
Is the request being sent?
Please provide more details of the problems. Better is a link to your page or a test case replicating the issues so we can help debug. Just posting code saying there are errors is not enough for us to help.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin