2013-01-05 85 views
0

我使用DataTables方式進行動態sql連接。 我想添加按鈕導出csv和xml,但它不會出現。 還是我誤會了我。不添加導出csv和xls

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'] 
      ] 
     });

謝謝

回答

0

已添加的插件js文件到您的網頁? DOWNLOAD LINK

此外,我認爲你需要包括swf文件,因爲這是按鈕的圖像。

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