我正在使用datatable.net。即使th和td列号相等,我也会收到此错误。 “未捕获的TypeError:无法设置未定义的属性'nTf'”
只有1个输入不会出现此错误。当我将其添加到其他输出时,我得到相同的错误。当所有输入都可用时,数据表ajax不起作用。
初始化完成没有运行。
$(window).resize(function() {
$("#gelenBasvurularim").attr("style", "width: 100%;border: #dddddd solid 1px !important;");
});
var tabLes = $('#gelenBasvurularim').DataTable({
"bServerSide": true,
"bProcessing": true,
"ordering": true,
"sorting": [
[0, 'asc']
],
"pageLength": 10,
"responsive": true,
"sAjaxSource": "/IncomingApplications/OnayListele",
"language": {
"url": "/assets/datatable/tr.json"
},
"columnDefs": [{
visible: true
}],
"LengthMenu": [
[10, 25, 50, 100, 500, 1000, 9999999],
[10, 25, 50, 100, 500, 1000, 'Tümünü Göster']
],
"select": "single",
"dom": 'lBfrtip',
"lengthChange": true,
"columns": [{
"data": "BildirimTuruMetni"
}],
"fnDrawCallback": function(oSettings) {
alert("draw call back " + oSettings);
$("#bildirimTables").attr("style", "width: 100%;");
},
"initComplete": function(settings, json) {
alert(1);
$("tfoot tr").appendTo("thead");
$('.search-input-text').on('keyup click',
function() {
console.log("input text");
var i = $(this).attr('data-column');
alert(i);
var v = $(this).val();
alert(v);
$('#gelenBasvurularim').DataTable().columns(i).search(v).draw();
});
$('.search-input-select').on('change',
function() {
var i = $(this).attr('data-column');
var v = $(this).val();
$('#gelenBasvurularim').DataTable().columns(i).search(v).draw();
});
}
});
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
<table id="gelenBasvurularim" class="table table-striped table-bordered table-hover dataTable no-footer">
<thead>
<tr>
<th>İsim</th>
<th>Soyisim</th>
<th>Birim Adı</th>
<th>Oluşturma Tarihi</th>
<th>Talep Türü Adı</th>
<th>Talep Durumu Adı</th>
</tr>
</thead>
<tfoot>
<tr>
<td><input type="text" data-column="0" class="search-input-text form-control"></td>
<td><input type="text" data-column="1" class="search-input-text form-control"></td>
<td><input type="text" data-column="2" class="search-input-text form-control"></td>
<td><input type="text" data-column="3" class="search-input-text form-control"></td>
<td><input type="text" data-column="4" class="search-input-text form-control"></td>
<td><input type="text" data-column="5" class="search-input-text form-control"></td>
</tr>
</tfoot>
</table>