显示带有数据表的列过滤器时出错: [英] error displaying column filter with data table:

查看:140
本文介绍了显示带有数据表的列过滤器时出错:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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">



当我在浏览器中查看表格时,看到错误:
数据表警告(表ID =示例"):无法重新初始化数据表.
要检索该表的数据表对象,请不传递任何参数,或参见
bRetrieve和bDestroy的文档




when I the table in browsers I see the error:
Data Tables warning (table id = ''example''): can not reinitialise Data Table.
To retrieve the data table object for this table, pass no arguments or see the
docs for bRetrieve and bDestroy


how to solve it??

推荐答案

(文档).ready(
(document).ready(function() {


(#example ').dataTable({ " :" 完整数字", }); }); var asInitVals = 数组();
('#example').dataTable( { "sPaginationType": "full_numbers", } ); } ); var asInitVals = new Array();


(文档).ready(功能(){
(document).ready(function() {


这篇关于显示带有数据表的列过滤器时出错:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆