我在我的项目中使用数据表,我的json对象是:
$scope.deviceObject2={"data":[{"name":"2112140","uniqueid":"2112140","devicetime":"2017-05-24 11:52:46.0","latitude":"35.77125286169377","longitude":"-5.808437570398858","id":2,"isbool":"0","input":"11000011 100","company":null},{"name":"2112128","uniqueid":"2112128","devicetime":"2017-06-01 10:39:45.0","latitude":"35.716249486319","longitude":"-5.904745473224603","id":3,"isbool":"0","input":"11000010 1000100","company":null}]
我想在数据表中加载这些数据:
storyboard.loaddatatable=function(){
var table = $('#example').DataTable( {
//"ajax": $scope.deviceObject2,
"columns": [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ "data": $scope.deviceObject2.data[0].name },
{ "data": $scope.deviceObject2.data[0].uniqueid },
{ "data": $scope.deviceObject2.data[0].devicetime },
{ "data": $scope.deviceObject2.data[0].longitude },
{ "data": $scope.deviceObject2.data[0].latitude }
],
"order": [[1, 'asc']]
} );
}
但它给了我一个错误:
DataTables警告:table id = example - 无法重新初始化DataTable。有关此错误的详细信息,请参阅http://datatables.net/tn/3
如何解决此错误?
答案 0 :(得分:0)