2017-02-20 12 views
2

は、ここに私のスクリーンショットです: enter image description hereJqueryのデータ型ボタンが機能しません。

この私の次のコードです:私はhttps://datatables.net/extensions/buttons/customから、このコードを使用しようとしている

<link href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css" rel="stylesheet"> 
<link href="https://cdn.datatables.net/buttons/1.2.4/css/buttons.dataTables.min.css" rel="stylesheet"> 


     <table id="example" class="display" cellspacing="0" width="100%"> 
     <thead> 
      <tr> 
       <th>Name</th> 
       <th>Position</th> 
       <th>Office</th> 
      </tr> 
     </thead> 
     <tbody> 
      <tr> 
       <td>Tiger Nixon</td> 
       <td>System Architect</td> 
       <td>Edinburgh</td> 

      </tr> 
      <tr> 
       <td>Garrett Winters</td> 
       <td>Accountant</td> 
       <td>Tokyo</td> 

      </tr> 
      </tbody> 
      </table> 

<script src="https://code.jquery.com/jquery-1.12.4.js"></script> 
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script 
<Script src="https://cdn.datatables.net/buttons/1.2.4/js/dataTables.buttons.min.js"></script> 


<script> 
$(document).ready(function() { 
    $('#example').DataTable({ 
     dom: 'Bfrtip', 
     buttons: [ 
      { 
       text: 'My button', 
       action: function (e, dt, node, config) { 
        alert('Button activated'); 
       } 
      } 
     ] 
    }); 
}); 
</script> 

。なぜmy buttonボタンが表示されなかったのですか?私はなぜこのコードが動作していないのだろうと思っていた。誰も "jQuery DataTables Button"の使い方を教えてください。

答えて

1
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script> 
<script src="https://cdn.datatables.net/buttons/1.2.4/js/dataTables.buttons.min.js"></script> 

スクリプトエラーがあります。これを試してみてください。

スクリーンショット:あなたは正しくからあなたが>欠けているscript tagを閉じていない http://prntscr.com/eazm0r

1

以下script tag

<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script> 
関連する問題