我在JavaScript和Java工作。使用jQuery DataTables,在数据表中添加"bServerSide": true时会出现错误。
TypeError: G为空 ...ata?a.fnServerData.call(j,a.sAjaxSource,h.map(b,函数(a,b)){返回{名称:B,值. jquery....min.js (第33行) TypeError: C未定义
在添加"sAjaxSource"之后,它会产生另一个错误:
is未定义
jQuery代码在下面。
 table2 = $('#table2').dataTable(
            {
                "info": false,
                "bLengthChange": false,
                "bFilter": true,
                "bServerSide" : true,
                "oLanguage": {"sSearch": ""},
                responsive: true,
                "paging": false,
               "sAjaxSource" : basePath+'/secure/bartender/list.json',
                "aoColumns" : [
                        {
                            "mData" : "srNo",
                            "bVisible":true 
                        }, 
                        {
                            "mData" : "craftBeerName",
                            "bVisible":true 
                        }, 
                        {
                            "mData" : "tapStatus",
                            "bVisible":true 
                        }, 
                        {
                            "mData" : "action",
                            "bSortable":false 
                        }
                ],
                "fnServerData" : function(sSource, aoData, fnCallback) {
                $.ajax({
                "dataType" : 'json',
                "type" : "GET",
                "url" : sSource,
                "data" : aoData,
                "success" : fnCallback
                });
                },
                "sPaginationType" : "full_numbers"
//                "iDisplayLength": 2
            });为什么会发生这种情况?
发布于 2015-07-01 11:36:39
"paging": false后面缺少一个逗号。
还请确保在<thead>/<tfoot>部分中有与数据中相同的列数量,使用aoColumns定义了4列。
https://stackoverflow.com/questions/31153777
复制相似问题