我有两个jquery Datatables,它们加载从服务器返回的json值。但是,只有第一个数据实例加载数据。查看从Firebug返回的错误,我得到“TypeError:this.domElement.parentNode为null”,Chrome也在其javascript控制台中给出错误“Uncaught TypeError:无法调用方法'appendChild'的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" }
]
});
});
我做错了什么?