2017-08-29 13 views
0

私は前の作業Datatablesを同様のコードで設定しましたが、何らかの理由で私のサイトのこの他の領域で動作しなくなり、TypeErrorをスローします:g [(d + i)] [f]Jquery Datatables TypeError未定義エラー

<table id="tableSearchResults" class="table table-striped table-hover"> 
<thead> 
<tr> 
    <th>Amenity</th> 
    <th>Activity</th> 
    <th>Period</th> 
    <th>Booked by</th> 
    <th>Unit</th> 
    <th>Reference</th> 
    <th>Status</th> 
    <th class="no-sort"></th> 
<tr> 
</thead><tbody></tbody></table> 


    var dataSet = [["Ballroom", "lalalala", "2/6/2017<br />10:00 AM - 12:30 PM", "Internal booking", "N/A", "", "<a href='#' id='payment43' data-toggle='popover' data-html='true' data-content='<b>Received By</b><br />Robert Benedetto<br />2/6/2017 2:59:24 PM'>PAID</a>", "<a href='amenity_booking.aspx?d=43&bb=0' onclick='return confirm(&quotAre you sure you want to permanently delete this booking?&quot);'><i class='fa fa-trash'></i></a>"], ["Ballroom", "Testing", "8/29/2017<br />9:00 AM - 9:30 AM", "HoangTest TranTest", "<a href='unit_info.aspx?uid=7005'>1S Narra, 1408</a>", "", "<span class='label label-danger'>PENDING</span>", "<a href='amenity_booking.aspx?d=44&bb=1' onclick='return confirm(&quotAre you sure you want to permanently delete this booking?&quot);'><i class='fa fa-trash'></i></a>"]]; 

    $("#tableSearchResults").DataTable({ 
     data: dataSet, 
     "deferRender": true, 
     "lengthMenu": [[50, 100, 150, 200, 250, -1], [50, 100, 150, 200, 250, "All"]], 
     "iDisplayLength": 100, 
     "order": [], 
     "columnDefs": [{ "targets": 'no-sort', "orderable": false }, { "searchable": false, "targets": [2, 6, 7] }] 
    }); 

誰がオフになっているものを見つけることができ:未定義

コードはありますか?私は確かにできません。

答えて

0

tr要素を閉じることができませんでした。</tr>ではなく、<tr>である必要があります。

+0

あなたは正しいです、ありがとうございます。しかしそれはそれを解決しません。 –

+0

それで解決しました。 ID名から#を削除して実験に追加していたのを忘れてしまった。ありがとう! –

+0

あなたのコードはうまくいきます。あなたの問題を解決しなかった理由は分かりません。https://jsfiddle.net/r5p1ovdq/ – Stavm

関連する問題