1

我有两个加载从服务器返回的 json 值的 jquery 数据表。然而,只有第一个数据实例加载数据。查看从 Firebug 返回的错误,我得到“TypeError: this.domElement.parentNode is null”,Chrome 还在其 javascript 控制台中给出了错误“Uncaught TypeError: Cannot call method 'appendChild' of null”。

下面是我的数据表的初始化代码

$(function() {
    var roleTable = $('#grid[rel*=roles_grid]').dataTable( {"bJQueryUI": false,
                "sPaginationType": "full_numbers",
                "sDom": 'T<"clear">lfrtip',
                "bSortClasses": true, 
                "oTableTools": { "sSwfPath": "resources/swf/copy_cvs_xls_pdf.swf" },
                "bProcessing": true,
                "bServerSide": true,
                "bRetrieve": true, 
                "sAjaxSource": "resources/server/json/setup.json.php",
                "aoColumns": [
                    { "mDataProp": "description" },
                    { "mDataProp": "notes" },
                    { "mDataProp": "id" }
                ]
            });

            var usersTable = $('#grid[rel*=users_grid]').dataTable( {
                "bJQueryUI": false,
                "sPaginationType": "full_numbers",
                "sDom": 'T<"clear">lfrtip',
                "bSortClasses": true, 
                "oTableTools": { "sSwfPath": "resources/swf/copy_cvs_xls_pdf.swf" },
                "bProcessing": true,
                "bServerSide": true,
                "bRetrieve": true,  
                "sAjaxSource": "resources/server/json/users.json.php",
                "aoColumns": [
                    { "mDataProp": "staff_no" },
                    { "mDataProp": "lastname" },
                    { "mDataProp": "firstname" },
                    { "mDataProp": "email" },
                    { "mDataProp": "primary_phone" },
                    { "mDataProp": "secondary_phone" },
                    { "mDataProp": "description" },
                    { "mDataProp": "id" }
                ]
            });
        });

我究竟做错了什么?

4

0 回答 0