2017-08-29 49 views
0

我設置了以前的工作Datatables與類似的代碼,但由於某種原因,在我的網站的這個其他領域它拒絕工作,並引發TypeError:g [(d + i)] [f]未定義Jquery Datatables TypeError undefined error

代碼:

<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

相關問題