0
votes

I use DataTables way of dynamic sql connection. I would like to add buttons export csv and xml, but it does not appear. Or am I mistaken me.

oTable = $('#tbl_result').dataTable( 
        {
            "sDom": 'T<"top"fl>rt<"bottom"pi>' ,
            "sPaginationType": "full_numbers",
            "bAutoWidth"    : false,    
            "bProcessing": true,
            "bSortClasses"  : false, 
            "iDisplayLength": 15,
            "bStateSave"    : false,    
            "bServerSide": true,
            "oLanguage": {
                "sUrl": "/includes/js/DataTables.fr.js"
            },
            "sAjaxSource": "sql-objects.php",
           "oTableTools": {
                "aButtons": [ "csv", "xls" ],
                {
                    "aButtons":    [ "csv", "xls", "" ]
                    "sExtends":    "collection",
                }
            }, 
            "fnRowCallback": function( nRow, aData, iDataIndex ) 
            {
                $('td:eq(1)', nRow).html( DateFr(aData['date']) ) ;
                $('td:eq(2)', nRow).html( ( aData['etat'] == '0' ? 'Inscrit' :  'En attente') ) ;
                $('td:eq(3)', nRow).html( '<a user="' + aData['mail'] + '" class="delete" href="?id_abonne='+ aData['mail'] +'"><img border="0" class="icon16 infobulle" src="/back_office/images/template/icon16-delete.png"></a>');
            },
            "aoColumns"     :
            [
                { "mData": "mail" },
                { "mData": "date" },
                { "mData": "etat" },
                { "mData": "cle", "bSortable": false}
            ],
            "aaSorting"     :
            [
                [0,'desc']
            ]
        });

thank you

1

1 Answers

0
votes

Have you added the plugin js file to your page? DOWNLOAD LINK

Also I think you need to include the swf file as that is the image for the buttons.

"oTableTools": {
            "sSwfPath": "/swf/copy_csv_xls_pdf.swf"
        }