列式搜索给出“227200:101 Uncaught TypeError:otable.api()。列不是函数”JQuery dataTable中的错误
我正在使用jquery-1.6.4.min.js和jquery.dataTables.min.js来获取jquery数据表。 而我收到的错误是:
Uncaught TypeError: otable.api is not a function at HTMLDocument. (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": "", "sDom": '<"H"lfr>t', "fnDrawCallback":function() { $parent = $(this).parent(); $parent.css("min-height", "0px"); }, "fnRowCallback": function( nRow, aData, iDisplayIndex ) { $('td:eq(0)', nRow).html('' + aData.sectionNumber + ''); $('td:eq(5)', nRow).html("" + aData.sectionStatus + ""); return nRow; }, "fnInitComplete": function(oSettings, json) { $(".headerTitle").html("Sections List"); }, "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( '' ); } ); 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(); } }); });