逐列搜索给“227200:101遗漏的类型错误:otable.api()的列是不是一个函数”在JQu

2019-11-05 01:23发布

我使用jQuery的1.6.4.min.js和jquery.dataTables.min.js jQuery的数据表。 而我得到一个错误:

Uncaught TypeError: otable.api is not a function
at HTMLDocument.<anonymous> (227200:100)
at Object.resolveWith (jquery-1.6.4.min.js:2)
at Function.ready (jquery-1.6.4.min.js:2)
at HTMLDocument.C (jquery-1.6.4.min.js:2)

而且因为我在我的整个应用程序中使用的dataTable与D我不能使用的DataTable资本

下面是我的JavaScript代码,将数据从Ajax调用来

 $(document).ready(function() { var otable = $('#sectionList').dataTable({ "bJQueryUI": true, "bFilter": true, "bSearchable": false, "bProcessing": true, "bServerSide": true, "bLengthChange": false, "iDisplayLength": 10, "sPaginationType": "full_numbers", "sAjaxSource": "<c:url value='/group/${groupVO.groupNum}/load' />", "sDom": '<"H"lfr<"headerTitle">>t<"F"ip>', "fnDrawCallback":function() { $parent = $(this).parent(); $parent.css("min-height", "0px"); }, "fnRowCallback": function( nRow, aData, iDisplayIndex ) { $('td:eq(0)', nRow).html('<a href="/CMSWeb/group/${groupVO.groupNum}/section/' + aData.sectionNumber + '">' + aData.sectionNumber + '</a>'); $('td:eq(5)', nRow).html("<span class='" + aData.sectionStatus.toLowerCase() + "'>" + aData.sectionStatus + "</span>"); return nRow; }, "fnInitComplete": function(oSettings, json) { $(".headerTitle").html("<span>Sections List</span>"); }, "aoColumns": [ { "mDataProp": "sectionNumber" }, { "mDataProp": "sectionDesc" }, { "mDataProp": "poolCode" }, { "mDataProp": "poolDescription" }, { "mDataProp": "contractTypes" }, { "mDataProp": "sectionStatus" } ], }); $('#sectionList tfoot th').each( function (i) { var title = $('#sectionList thead th').eq($(this).index()).text(); $(this).html( '<input type="text" placeholder="Search '+title+'" />' ); } ); otable.api().columns().every( function () { var that = this; $( 'input', this.footer() ).on( 'keyup change', function () { if ( that.search() !== this.value ) { that .search( this.value ) .draw(); } }); }); 

文章来源: Column wise search giving “227200:101 Uncaught TypeError: otable.api().columns is not a function” error in JQuery dataTable