jQuery datatables TypeError:b为null

时间:2014-07-10 18:15:55

标签: javascript jquery datatable

使用jquery datatables插件时,我面临Firebug触发的错误 表格如下:

                    <table id="dt_cursuri" class="table table-striped table-bordered dTableR">
                        <thead>
                            <tr>
                                <th data-class="expand">Curs</th>
                                <th data-hide="phone,tablet" data-name="Assign">Domeniu</th>
                                <th>Tip</th>
                                <th>Data modif</th>
                                <th class="centered-cell">Actiuni</th>
                            </tr>                                   
                        </thead>
                        <tbody>
                            <tr>
                                <td class="dataTables_empty" colspan="6">Fetching data from server</td>
                            </tr>
                        </tbody>
                    </table>

数据表初始化:

        var oTable;
        var responsiveHelper = undefined;
        var breakpointDefinition = {
            tablet: 1024,
            phone : 480
        };
        var oTable = $('#dt_cursuri');

        oTable = $('#dt_cursuri').dataTable( {
            "bProcessing": true,
            "bServerSide": true,
            "sPaginationType": "bootstrap",
            "sDom": "<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>",
            "sAjaxSource": "view/cursuri/server_side.php",
            autoWidth : false,
            "fnPreDrawCallback": function () {
                // Initialize the responsive datatables helper once.
                if (!responsiveHelper) {
                    responsiveHelper = new ResponsiveDatatablesHelper(oTable, breakpointDefinition);
                }
            },
            "fnDrawCallback" : function (oSettings) {
                responsiveHelper.respond();
            }, 
            "fnRowCallback": function( nRow, aData ) {
                responsiveHelper.createExpandIcon(nRow);
            },                                         
            "aoColumns": [
                //{ "sClass": "center",  "bSortable": false, sWidth: '2%', "bVisible": false },
                { sWidth: '35%' },
                { sWidth: '25%' },
                { sWidth: '20%' },
                { sWidth: '10%' },
                { "sClass": "center", sWidth: '10%', "bSortable": false }
            ],              
            "aaSorting": [[2, 'asc']]
        } );

服务器端json文件正在运行。在其他完美的表中使用相同的代码,但这个代码不是

有人可以帮助我吗? 从jquery.datatables.js:

为该行触发错误
!a.sLoadingRecords && (c && 'Loading...' === b.sLoadingRecords) && D(a, a, 'sZeroRecords', 'sLoadingRecords'); 

1 个答案:

答案 0 :(得分:3)

我将自己回答这个问题,感谢jQuery Datatables的开发人员。 问题出在服务器端处理中。当使用变音符号时,数据表正在弄乱数据,所以你必须用utf8_encode()php函数实际控制变音符号