【问题标题】:Jquery Datatables TypeError undefined errorJquery Datatables TypeError未定义错误
【发布时间】:2017-08-29 10:16:17
【问题描述】:

我已经用类似的代码设置了以前的工作数据表,但由于某种原因,在我网站的其他区域它拒绝工作,并抛出 TypeError: g[(d + i)][f] is undefined

代码:

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

任何人都可以发现任何不正常的地方吗?我肯定不能。

【问题讨论】:

    标签: jquery datatables


    【解决方案1】:

    你没有关闭tr元素,它应该是&lt;/tr&gt;而不是&lt;tr&gt;

    【讨论】:

    • 你是对的,谢谢,但它并没有解决它。
    • 它确实解决了它。已从 ID 名称中删除 # 进行实验,忘记添加它。谢谢!
    • 您的代码运行良好,不知道为什么您说它没有解决您的问题jsfiddle.net/r5p1ovdq
    猜你喜欢
    • 2014-08-06
    • 2021-05-01
    • 2014-06-21
    • 2015-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-25
    相关资源
    最近更新 更多