<script type="text/javascript" charset="utf-8">
//initialisation code
$(document).ready(function() {
$('#example').dataTable( {
"sPaginationType": "full_numbers",
} );
} );
var asInitVals = new Array();
$(document).ready(function() {
$("tfoot input").each( function (i) {
asInitVals[i] = this.value;
} );
$("tfoot input").focus( function () {
if ( this.className == "search_init" )
{
this.className = "";
this.value = "";
}
} );
$("tfoot input").blur( function (i) {
if ( this.value == "" )
{
this.className = "search_init";
this.value = asInitVals[$("tfoot input").index(this)];
}
} );
var oTable = $('.exam').dataTable( {
"oLanguage": {
"sSearch": "Search all columns:"
},
"bStateSave": true,
"fnInitComplete": function() {
var oSettings = $('.exam').dataTable().fnSettings();
for ( var i=0 ; i<oSettings.aoPreSearchCols.length ; i++ ){
if(oSettings.aoPreSearchCols[i].sSearch.length>0){
$("tfoot input")[i].value = oSettings.aoPreSearchCols[i].sSearch;
$("tfoot input")[i].className = "";
}
}
}
} );
$("tfoot input").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, $("tfoot input").index(this) );
} );
} );
</script>
</head>
<body>
<table id="example" class = "exam" width="100%" border="1" cellpadding="0" cellspacing="0" class="pretty" align="center">
我是 jquery 编程的新手。当我在浏览器中查看表格时,我看到了错误:
数据表警告(表 id = 'example'):无法重新初始化数据表。要检索此表的数据表对象,请不传递任何参数或查看 bRetrieve 和 bDestroy 的文档
如何解决这个问题呢??