DataTable Uncaught TypeError:无法读取未定义的属性“cell”

时间:2015-07-02 03:40:03

标签: javascript jquery

我有一个dataTable,本地数据包含8个标题/行。但是我得到了Uncaught TypeError:无法读取undefined的属性'cell'。我做了一些调查,如果我只注释掉其中一个列,那么我就不会再出错了。似乎我的表只能显示7行。你知道怎么解决这个问题吗?

                data.loginEmail = img.attr('data-email');
                data.firstName = img.attr('data-firstname');
                data.surname = img.attr('data-surname');
                data.customer = img.attr('data-customer');
                data.roles = img.attr('data-roles');
                data.currentStatus = img.attr('data-status');
                data.lastInviteSent = img.attr('data-lastemailsent');
                data.removeReq= img.attr('data-removeReq');

数据

    $('table.data-edit-invitations').dataTable({
            "sDom": '<"top">rtipl',
            "bPaginate": false,
            "sPaginationType": "full_numbers",
            "sScrollY": "345px",
            "bScrollCollapse": true,
            "bFilter": false,
            "bSort": false,
            "bSortCellsTop": false,
            "aoColumns": [
                { "sType": 'string-case', "sClass": 'surname', "mData": "surname"},
                { "sType": 'string-case', "sClass": 'firstName', "mData": "firstName"},
                { "sType": 'string-case', "sClass": 'loginEmail', "mData": "loginEmail"},
                { "sType": 'string-case', "sClass": 'customer', "mData": "customer"},
                { "sType": 'string-case', "sClass": 'capabilities', "mData": "roles" },
                { "sType": 'string-case', "sClass": 'currentStatus', "mData": "currentStatus" },
                { "sType": 'string-case', "sClass": 'lastInviteSent', "mData": "lastInviteSent" },
                { "sType": 'string-case', "sClass": 'removeReq', "mData": "removeReq" }
            ],
            "oLanguage": {
                "sEmptyTable": '<span>No data available</span>',
                "sProcessing": "<span>Processing</span>"
            },
            "bProcessing": true,
            "fnDrawCallback": function () {
                   //some code here
            });

代码

$('#test').each(function(){
     var attributeValue = $(this).attr('data-same');
     //do whatever you want with the value
});

PS:当我在标题和aoColumn中注释掉removeReq时。有用。当我注释掉lastInviteSent并取消注释removeReq时它也可以工作。两者都存在时就不行了!

0 个答案:

没有答案